Skip to content

Commit 3949415

Browse files
authored
Merge pull request ethereum#1341 from cffls/develop
Backporting master to develop
2 parents b8901bc + 65d11a9 commit 3949415

File tree

22 files changed

+217
-54
lines changed

22 files changed

+217
-54
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
- name: Test
108108
run: make test
109109

110-
- uses: actions/upload-artifact@v4
110+
- uses: actions/upload-artifact@v4.4.0
111111
with:
112112
name: unitTest-coverage
113113
path: cover.out
@@ -158,7 +158,7 @@ jobs:
158158
- name: test-integration
159159
run: make test-integration
160160

161-
- uses: actions/upload-artifact@v4
161+
- uses: actions/upload-artifact@v4.4.0
162162
with:
163163
name: integrationTest-coverage
164164
path: cover.out
@@ -174,7 +174,7 @@ jobs:
174174
- name: Checkout
175175
uses: actions/checkout@v4
176176
- name: Download artifacts
177-
uses: actions/download-artifact@v4
177+
uses: actions/download-artifact@v4.1.8
178178
- name: Upload coverage to Codecov
179179
uses: codecov/codecov-action@v3
180180

@@ -258,7 +258,7 @@ jobs:
258258
259259
- name: Upload logs
260260
if: always()
261-
uses: actions/upload-artifact@v4
261+
uses: actions/upload-artifact@v4.4.0
262262
with:
263263
name: logs_${{ github.run_id }}
264264
path: |
@@ -277,7 +277,7 @@ jobs:
277277
278278
- name: Upload code and chain data
279279
if: always()
280-
uses: actions/upload-artifact@v4
280+
uses: actions/upload-artifact@v4.4.0
281281
with:
282282
name: code_${{ github.run_id }}
283283
path: code.tar.gz

.github/workflows/govuln.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fail-on-vuln: true
2020

2121
- name: Upload govulncheck report
22-
uses: actions/upload-artifact@v3
22+
uses: actions/upload-artifact@v4.4.0
2323
with:
2424
name: raw-report
2525
path: raw-report.json

accounts/abi/bind/base_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ import (
2929
"github.com/ethereum/go-ethereum/accounts/abi/bind"
3030
"github.com/ethereum/go-ethereum/common"
3131
"github.com/ethereum/go-ethereum/common/hexutil"
32+
"github.com/ethereum/go-ethereum/core/state"
3233
"github.com/ethereum/go-ethereum/core/types"
3334
"github.com/ethereum/go-ethereum/crypto"
35+
"github.com/ethereum/go-ethereum/internal/ethapi"
3436
"github.com/ethereum/go-ethereum/rlp"
37+
"github.com/ethereum/go-ethereum/rpc"
3538
"github.com/stretchr/testify/assert"
3639
)
3740

@@ -94,6 +97,10 @@ func (mc *mockCaller) CallContract(ctx context.Context, call ethereum.CallMsg, b
9497
return mc.callContractBytes, mc.callContractErr
9598
}
9699

100+
func (mc *mockCaller) CallWithState(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, state *state.StateDB, overrides *ethapi.StateOverride, blockOverrides *ethapi.BlockOverrides) (hexutil.Bytes, error) {
101+
return mc.CallContract(ctx, ethereum.CallMsg{}, nil)
102+
}
103+
97104
type mockPendingCaller struct {
98105
*mockCaller
99106
pendingCodeAtBytes []byte

builder/files/genesis-amoy.json

Lines changed: 24 additions & 1 deletion
Large diffs are not rendered by default.

builder/files/genesis-mainnet-v1.json

Lines changed: 15 additions & 0 deletions
Large diffs are not rendered by default.

cmd/utils/flags.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
20192019
}
20202020
}
20212021

2022-
log.Info("flags", "genesis", cfg.Genesis)
20232022
// Set any dangling config values
20242023
if ctx.String(CryptoKZGFlag.Name) != "gokzg" && ctx.String(CryptoKZGFlag.Name) != "ckzg" {
20252024
Fatalf("--%s flag must be 'gokzg' or 'ckzg'", CryptoKZGFlag.Name)
@@ -2095,7 +2094,6 @@ func RegisterFilterAPI(stack *node.Node, backend ethapi.Backend, ethcfg *ethconf
20952094
}})
20962095

20972096
// avoiding constructor changed by introducing new method to set genesis
2098-
log.Info("filterAPI", "genesis", ethcfg.Genesis)
20992097
filterAPI.SetChainConfig(ethcfg.Genesis.Config)
21002098

21012099
return filterSystem

consensus/bor/api/caller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import (
44
"context"
55

66
"github.com/ethereum/go-ethereum/common/hexutil"
7+
"github.com/ethereum/go-ethereum/core/state"
78
"github.com/ethereum/go-ethereum/internal/ethapi"
89
"github.com/ethereum/go-ethereum/rpc"
910
)
1011

1112
//go:generate mockgen -destination=./caller_mock.go -package=api . Caller
1213
type Caller interface {
1314
Call(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *ethapi.StateOverride, blockOverrides *ethapi.BlockOverrides) (hexutil.Bytes, error)
15+
CallWithState(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, state *state.StateDB, overrides *ethapi.StateOverride, blockOverrides *ethapi.BlockOverrides) (hexutil.Bytes, error)
1416
}

consensus/bor/api/caller_mock.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

consensus/bor/contract/client.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ func (gc *GenesisContractsClient) LastStateId(state *state.StateDB, number uint6
119119
toAddress := common.HexToAddress(gc.StateReceiverContract)
120120
gas := (hexutil.Uint64)(uint64(math.MaxUint64 / 2))
121121

122-
// Do a call with state so that we can fetch the last state ID from a given (incoming)
123-
// state instead of local(canonical) chain.
124-
result, err := gc.ethAPI.Call(context.Background(), ethapi.TransactionArgs{
122+
// BOR: Do a 'CallWithState' so that we can fetch the last state ID from a given (incoming)
123+
// state instead of local(canonical) chain's state.
124+
result, err := gc.ethAPI.CallWithState(context.Background(), ethapi.TransactionArgs{
125125
Gas: &gas,
126126
To: &toAddress,
127127
Data: &msgData,
128-
}, &rpc.BlockNumberOrHash{BlockNumber: &blockNr, BlockHash: &hash}, nil, nil)
128+
}, &rpc.BlockNumberOrHash{BlockNumber: &blockNr, BlockHash: &hash}, state, nil, nil)
129129
if err != nil {
130130
return nil, err
131131
}

core/state/statedb.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,13 @@ func MVRead[T any](s *StateDB, k blockstm.Key, defaultV T, readStorage func(s *S
355355
return defaultV
356356
}
357357

358-
// TODO: I assume we don't want to overwrite an existing read because this could - for example - change a storage
359-
// read to map if the same value is read multiple times.
360-
if _, ok := s.readMap[k]; !ok {
358+
if prevRd, ok := s.readMap[k]; !ok {
361359
s.readMap[k] = rd
360+
} else {
361+
if prevRd.Kind != rd.Kind || prevRd.V.TxnIndex != rd.V.TxnIndex || prevRd.V.Incarnation != rd.V.Incarnation {
362+
s.dep = rd.V.TxnIndex
363+
panic("Read conflict detected")
364+
}
362365
}
363366

364367
return

0 commit comments

Comments
 (0)