Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdjustBlockRange enhancement #874

Open
matejmode opened this issue Nov 28, 2023 · 6 comments
Open

AdjustBlockRange enhancement #874

matejmode opened this issue Nov 28, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@matejmode
Copy link
Collaborator

  • skip of AdjustBlockRange could be done by adding ! before the block number (alternatively #)
  • LastBlockArg should also have AdjustBlockRange just for cfg.last block
@matejmode matejmode added the enhancement New feature or request label Nov 28, 2023
@matejmode matejmode changed the title AdjustBlockRange AdjustBlockRange enhancement Nov 28, 2023
@wsodsong
Copy link
Collaborator

Can you elaborate on the use case of this new feature?

@matejmode
Copy link
Collaborator Author

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.

@matejmode
Copy link
Collaborator Author

matejmode commented Nov 28, 2023

Example use of ! override. #869 (comment) New deletionDb can get generated into separate directory and then hash can be directly checked - even tho database doesnt have metadata.

@wsodsong
Copy link
Collaborator

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.

@Lubomir-Jahn
Copy link
Collaborator

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.

@matejmode
Copy link
Collaborator Author

matejmode commented Dec 2, 2023

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/[email protected]/substate_db.go:475 +0x8f
github.com/Fantom-foundation/Substate.(*SubstateDB).GetFirstSubstate(0x1dd1560?)
        /home/matej/go/pkg/mod/github.com/!fantom-foundation/[email protected]/substate_db.go:338 +0x3e
github.com/Fantom-foundation/Substate.GetFirstSubstate(...)
        /home/matej/go/pkg/mod/github.com/!fantom-foundation/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/app.go:332 +0x5b7
github.com/urfave/cli/v2.(*App).Run(...)
        /home/matej/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:309
main.main()
        /usr/local/src/Aida/cmd/util-db/main.go:42 +0x3d 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants