Open matejmode opened 9 months ago
Can you elaborate on the use case of this new feature?
First - LastArg(last) is used in multiple commands and I believe it should have same adjustment properties as RangeArg(first,last). Second - The override would be usefull when handling database without metadata.
Example use of !
override. https://github.com/Fantom-foundation/Aida/pull/869#discussion_r1407035546 New deletionDb can get generated into separate directory and then hash can be directly checked - even tho database doesnt have metadata.
I see, this is more about a behavior change when using aida-db with no metadata. Instead of introducing a new flag works?
Current: throw an error asking users to generate metadata if it doesn't exist (@Lubomir-Jahn can you confirm this?). Change: take user range as is if metadata doesn't exist. Throw errors if keywords are passed.
Current behavior is that if opening AidaDB or reading its metadata somehow fails, we throw a warning and use user arguments as they are, without any adjustments to the range. If this is the case and user call for the first/last/lastpatch keyword, the default value for given keyword is used.
Currently it doesn't even get tu printing out the warning.
opera@xapi239:/var/data/aida-autogen/support-databases$ /usr/local/src/Aida/build/util-db print-table-hash --aida-db del
etion-db-0-69673605/ --db-component delete 0 10
2023/12/02 10:29:34 WARNING: ChainID (--chainid) was not set; looking for it in AidaDb
INFO [12-02|10:29:34.970] Allocated cache and file handles database=deletion-db-0-69673605/ cache=1024.00MiB handles=100 readonly=true
2023/12/02 10:29:35 WARNING: ChainID was neither specified with flag (--chainid) nor was found in AidaDb (deletion-db-0-69673605/); setting default value for mainnet
INFO [12-02|10:29:35.492] Allocated cache and file handles database=deletion-db-0-69673605/ cache=1024.00MiB handles=100 readonly=true
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7f484f]
goroutine 1 [running]:
github.com/Fantom-foundation/Substate.NewSubstateIterator(0x48f91c?, 0x1)
/home/matej/go/pkg/mod/github.com/!fantom-foundation/!substate@v0.0.0-20231129093658-a074f38004d0/substate_db.go:475 +0x8f
github.com/Fantom-foundation/Substate.(*SubstateDB).GetFirstSubstate(0x1dd1560?)
/home/matej/go/pkg/mod/github.com/!fantom-foundation/!substate@v0.0.0-20231129093658-a074f38004d0/substate_db.go:338 +0x3e
github.com/Fantom-foundation/Substate.GetFirstSubstate(...)
/home/matej/go/pkg/mod/github.com/!fantom-foundation/!substate@v0.0.0-20231129093658-a074f38004d0/static_substate_db.go:116
github.com/Fantom-foundation/Aida/utils.FindBlockRangeInSubstate()
/usr/local/src/Aida/utils/metadata.go:984 +0x1f
github.com/Fantom-foundation/Aida/utils.(*AidaDbMetadata).getBlockRange(0xc000029730)
/usr/local/src/Aida/utils/metadata.go:1077 +0x45
github.com/Fantom-foundation/Aida/utils.getMdBlockRange({0x7ffdeab887b0, 0x17}, 0xc0000297f0?, {0x1df49c0, 0xc005444b70}, {0x1af6ddc, 0x4})
/usr/local/src/Aida/utils/config.go:399 +0x40d
github.com/Fantom-foundation/Aida/utils.updateConfigBlockRange({0xc01cb82040, 0xc005444510?, 0x1af7c9b?}, 0xc0004a7800, 0x0?, {0x1df49c0, 0xc005444b70})
/usr/local/src/Aida/utils/config.go:491 +0x96
github.com/Fantom-foundation/Aida/utils.NewConfig(0xc005446cc0, 0xc005446bc0?)
/usr/local/src/Aida/utils/config.go:236 +0x265
github.com/Fantom-foundation/Aida/cmd/util-db/db.printTableHash(0xc000025b68?)
/usr/local/src/Aida/cmd/util-db/db/info.go:253 +0x25
github.com/urfave/cli/v2.(*Command).Run(0x2aaf9c0, 0xc005446cc0, {0xc0001a0b60, 0x7, 0x7})
/home/matej/go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/command.go:274 +0x998
github.com/urfave/cli/v2.(*Command).Run(0xc00035e840, 0xc005446c00, {0xc000148000, 0x8, 0x8})
/home/matej/go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/command.go:267 +0xbe5
github.com/urfave/cli/v2.(*App).RunContext(0x2ab0c80, {0x1de1910?, 0x2cafd20}, {0xc000148000, 0x8, 0x8})
/home/matej/go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/app.go:332 +0x5b7
github.com/urfave/cli/v2.(*App).Run(...)
/home/matej/go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/app.go:309
main.main()
/usr/local/src/Aida/cmd/util-db/main.go:42 +0x3d
!
before the block number (alternatively#
)