-
Notifications
You must be signed in to change notification settings - Fork 277
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
feat(snapshot): provide snapshot structure acceleration #324
base: develop
Are you sure you want to change the base?
Changes from 81 commits
9485284
87d01e6
8f18c57
c107000
cbda0e0
ff4b17b
406cf81
a6c009a
4695cfc
fecd2f7
9030b56
85d7085
ceeff53
d9620b9
d77935d
31ad213
8c6e7dd
cf1d46b
095a0c0
dc98589
9df7803
3c80d49
0cdb57f
b16a518
c5df8ef
b857a85
2b5c2ac
bec5e8e
092de1e
065e203
1f07ad1
ef113e0
17e9f23
826c66a
0eedd3a
f217e05
43db248
df91a1e
945789f
4c6e214
48d8eaf
4de19cc
895ac7f
fd8382d
1816186
6110df9
c1339d8
0e21b17
c67e3e4
b5850c2
af4ffc7
d596e08
53e58c1
d7fb7c2
0120513
a34513d
d61cef6
ace8416
0290fab
c5f6453
4ffc934
6ca5353
5bb7436
ee908e3
811e93a
b3dce78
50640b3
1a7417d
7ada128
239c07a
77c4db5
fc90758
fee15c7
9dc5d2d
71c9917
29b2943
838aaaa
0fc49c5
868258f
39b9d99
35cb810
5deab05
ed09860
987d7ad
1009e84
0059a2a
ec5c3a9
339e03f
8c6618f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -570,6 +570,7 @@ func TestLowCommitCrashWithNewSnapshot(t *testing.T) { | |
// committed point so the chain should be rewound to genesis and the disk layer | ||
// should be left for recovery. | ||
func TestHighCommitCrashWithNewSnapshot(t *testing.T) { | ||
skipForTrieDB(t) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do these tests have to be skipped explicitly now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is because this test relies on the behavior of the GC in the trie. |
||
// Chain: | ||
// G->C1->C2->C3->C4->C5->C6->C7->C8 (HEAD) | ||
// | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1512,6 +1512,7 @@ func TestBlockchainHeaderchainReorgConsistency(t *testing.T) { | |
// Tests that importing small side forks doesn't leave junk in the trie database | ||
// cache (which would eventually cause memory issues). | ||
func TestTrieForkGC(t *testing.T) { | ||
skipForTrieDB(t) | ||
// Generate a canonical chain to act as the main dataset | ||
engine := ethash.NewFaker() | ||
|
||
|
@@ -1747,8 +1748,8 @@ func TestInsertReceiptChainRollback(t *testing.T) { | |
// overtake the 'canon' chain until after it's passed canon by about 200 blocks. | ||
// | ||
// Details at: | ||
// - https://github.com/scroll-tech/go-ethereum/issues/18977 | ||
// - https://github.com/scroll-tech/go-ethereum/pull/18988 | ||
// - https://github.com/scroll-tech/go-ethereum/issues/18977 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should avoid this changes on the blanks to kept the comment style consistent. I guess this unexpected updating is induced by golang 1.19/20 so in our project I advice to stick in 1.18 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I have try my best to resolve this comment style inconsistent problems just now, you may refresh and check |
||
// - https://github.com/scroll-tech/go-ethereum/pull/18988 | ||
func TestLowDiffLongChain(t *testing.T) { | ||
// Generate a canonical chain to act as the main dataset | ||
engine := ethash.NewFaker() | ||
|
@@ -1867,7 +1868,8 @@ func testSideImport(t *testing.T, numCanonBlocksInSidechain, blocksBetweenCommon | |
// That is: the sidechain for import contains some blocks already present in canon chain. | ||
// So the blocks are | ||
// [ Cn, Cn+1, Cc, Sn+3 ... Sm] | ||
// ^ ^ ^ pruned | ||
// | ||
// ^ ^ ^ pruned | ||
func TestPrunedImportSide(t *testing.T) { | ||
//glogger := log.NewGlogHandler(log.StreamHandler(os.Stdout, log.TerminalFormat(false))) | ||
//glogger.Verbosity(3) | ||
|
@@ -2472,9 +2474,9 @@ func BenchmarkBlockChain_1x1000Executions(b *testing.B) { | |
// This internally leads to a sidechain import, since the blocks trigger an | ||
// ErrPrunedAncestor error. | ||
// This may e.g. happen if | ||
// 1. Downloader rollbacks a batch of inserted blocks and exits | ||
// 2. Downloader starts to sync again | ||
// 3. The blocks fetched are all known and canonical blocks | ||
// 1. Downloader rollbacks a batch of inserted blocks and exits | ||
// 2. Downloader starts to sync again | ||
// 3. The blocks fetched are all known and canonical blocks | ||
func TestSideImportPrunedBlocks(t *testing.T) { | ||
// Generate a canonical chain to act as the main dataset | ||
engine := ethash.NewFaker() | ||
|
@@ -2636,20 +2638,19 @@ func TestDeleteCreateRevert(t *testing.T) { | |
|
||
// TestInitThenFailCreateContract tests a pretty notorious case that happened | ||
// on mainnet over blocks 7338108, 7338110 and 7338115. | ||
// - Block 7338108: address e771789f5cccac282f23bb7add5690e1f6ca467c is initiated | ||
// with 0.001 ether (thus created but no code) | ||
// - Block 7338110: a CREATE2 is attempted. The CREATE2 would deploy code on | ||
// the same address e771789f5cccac282f23bb7add5690e1f6ca467c. However, the | ||
// deployment fails due to OOG during initcode execution | ||
// - Block 7338115: another tx checks the balance of | ||
// e771789f5cccac282f23bb7add5690e1f6ca467c, and the snapshotter returned it as | ||
// zero. | ||
// - Block 7338108: address e771789f5cccac282f23bb7add5690e1f6ca467c is initiated | ||
// with 0.001 ether (thus created but no code) | ||
// - Block 7338110: a CREATE2 is attempted. The CREATE2 would deploy code on | ||
// the same address e771789f5cccac282f23bb7add5690e1f6ca467c. However, the | ||
// deployment fails due to OOG during initcode execution | ||
// - Block 7338115: another tx checks the balance of | ||
// e771789f5cccac282f23bb7add5690e1f6ca467c, and the snapshotter returned it as | ||
// zero. | ||
// | ||
// The problem being that the snapshotter maintains a destructset, and adds items | ||
// to the destructset in case something is created "onto" an existing item. | ||
// We need to either roll back the snapDestructs, or not place it into snapDestructs | ||
// in the first place. | ||
// | ||
func TestInitThenFailCreateContract(t *testing.T) { | ||
var ( | ||
// Generate a canonical chain to act as the main dataset | ||
|
@@ -2838,13 +2839,13 @@ func TestEIP2718Transition(t *testing.T) { | |
|
||
// TestEIP1559Transition tests the following: | ||
// | ||
// 1. A transaction whose gasFeeCap is greater than the baseFee is valid. | ||
// 2. Gas accounting for access lists on EIP-1559 transactions is correct. | ||
// 3. Only the transaction's tip will be received by the coinbase. | ||
// 4. The transaction sender pays for both the tip and baseFee. | ||
// 5. The coinbase receives only the partially realized tip when | ||
// gasFeeCap - gasTipCap < baseFee. | ||
// 6. Legacy transaction behave as expected (e.g. gasPrice = gasFeeCap = gasTipCap). | ||
// 1. A transaction whose gasFeeCap is greater than the baseFee is valid. | ||
// 2. Gas accounting for access lists on EIP-1559 transactions is correct. | ||
// 3. Only the transaction's tip will be received by the coinbase. | ||
// 4. The transaction sender pays for both the tip and baseFee. | ||
// 5. The coinbase receives only the partially realized tip when | ||
// gasFeeCap - gasTipCap < baseFee. | ||
// 6. Legacy transaction behave as expected (e.g. gasPrice = gasFeeCap = gasTipCap). | ||
func TestEIP1559Transition(t *testing.T) { | ||
var ( | ||
aa = common.HexToAddress("0x000000000000000000000000000000000000aaaa") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we totally drop any options for non-zktrie db within this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I understand that there is no reason for us to use the original trie for related operations involving state? However, in some places where block, transaction and receipt trie are calculated, the original trie is still used