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

Merge v1.11.3 #218

Merged
merged 47 commits into from
Jun 6, 2023
Merged

Merge v1.11.3 #218

merged 47 commits into from
Jun 6, 2023

Conversation

Tristan-Wilson
Copy link
Member

@Tristan-Wilson Tristan-Wilson commented May 11, 2023

Notes for initial merge commit and resolution

  • setHeadBeyondRoot call site had minor change of header.NumberU64() to head.Number.Uint64(), was missing arbitrum SnapshotRestoreMaxGas and diskRootFound return. Added it back in.
  • Many minor changes of header.NumberU64() to head.Number.Uint64().
  • ethapi.Backend changed CurrentBlock() return from *types.Block to *types.Header, updated NodeInterfaceBackendAPI
  • types.TxData interface adds effectiveGasPrice, placeholders currently for arb txs.
  • flatCallTracer is missing various arbitrum tracers.Tracer methods, added
    stubs.
    See comments on subsequent commits for other changes.

Notes on geth unit tests

 Fail on vanilla v1.11.3
 --- FAIL: TestSequentialRead (0.00s)
 --- FAIL: TestSequentialReadByteLimit (0.00s)
 --- FAIL: TestFreezerReadonly (0.00s)
 --- FAIL: TestRandom (0.00s)

 Fails expectedly due to our modifications to Tree.Cap function
 FAIL    github.com/ethereum/go-ethereum/core/rawdb      0.154s
 --- FAIL: TestPostCapBasicDataAccess (0.00s)

 Already was failing on our branch.
 FAIL
 FAIL    github.com/ethereum/go-ethereum/core/state/snapshot     3.550s
 --- FAIL: TestCallTracerNative (0.00s)
     --- FAIL: TestCallTracerNative/simpleOnlytop (0.00s)
 --- FAIL: TestCallTracerNativeWithLog (0.00s)
     --- FAIL: TestCallTracerNativeWithLog/simple (0.00s)
     --- FAIL: TestCallTracerNativeWithLog/calldata (0.00s)
     --- FAIL: TestCallTracerNativeWithLog/withOnlyTopCall (0.00s)
     --- FAIL: TestCallTracerNativeWithLog/txPartialFailed (0.00s)
     --- FAIL: TestCallTracerNativeWithLog/notopic (0.00s)
     --- FAIL: TestCallTracerNativeWithLog/delegatecall (0.00s)
     --- FAIL: TestCallTracerNativeWithLog/multilogs (0.00s)
     --- FAIL: TestCallTracerNativeWithLog/multiContracts (0.01s)
 --- FAIL: TestZeroValueToNotExitCall (0.00s)
 FAIL    github.com/ethereum/go-ethereum/eth/tracers/internal/tracetest  0.086s

holiman and others added 30 commits February 17, 2023 15:34
ci: disable coverage reporting in appveyor and travis
This improves the speed of DHT crawling by using concurrent requests.
It also removes logging of individual DNS updates.
…377)

Adds support for a native call tracer with the Parity format, which outputs call frames
in a flat array. This tracer accepts the following options:

- `convertParityErrors: true` will convert error messages to match those of Parity
- `includePrecompiles: true` will report all calls to precompiles. The default
  matches Parity's behavior where CALL and STATICCALLs to precompiles are excluded

Incompatibilities with Parity include:

- Parity removes the result object in case of failure. This behavior is maintained
  with the exception of reverts. Revert output usually contains useful information,
  i.e. Solidity revert reason.
- The `gasUsed` field accounts for intrinsic gas (e.g. 21000 for simple transfers)
  and refunds unlike Parity
- Block rewards are not reported

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
This fixes an issue where the withdrawal index was not calculated correctly
for multiple withdrawals in a single block.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
* ethdb/pebble: fix range compaction

* ethdb/pebble: add comment
* include withdrawals in ethclient responses

* omit empty withdrawals array in json serialization
* core: params: schedule Shanghai on goerli

* core/forkid: fix comment
This change adds a struct field EffectiveGasPrice in types.Receipt. The field is present
in RPC responses, but not in the Go struct, and thus can't easily be accessed via ethclient.

Co-authored-by: PulsarAI <dev@pulsar-systems.fi>
Fixes a race in TestNewPayloadOnInvalidTerminalBlock where setting the TTD raced with
the miner. Solution: set the TTD on the blockchain config not the genesis config.

Also fixes a race in CopyHeader which resulted in race reports all over the place.
This PR changes metrics collection to actually measure the time interval between collections, rather
than assume 3 seconds. I did some ad hoc profiling, and on slower hardware (eg, my Raspberry Pi 4)
I routinely saw intervals between 3.3 - 3.5 seconds, with some being as high as 4.5 seconds. This
will generally cause the CPU gauge readings to be too high, and in some cases can cause impossibly
large values for the CPU load metrics (eg. greater than 400 for a 4 core CPU).

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
This fixes a regression introduced by #26723.
Fixes #26816.
…(#26799)

This change fixes a flaw where, in certain scenarios, the block sealer did not accurately reset the remaining gas after failing to include an invalid transaction. Fixes #26791
…al (#26667)

Checks that Transaction.MarshalJSON and newRPCTransaction JSON output can be parsed by Transaction.UnmarshalJSON

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Fixes a minor error in the testdata
This PR mitigates an issue with Ledger's on-device RLP deserialization, see
LedgerHQ/app-ethereum#409

Ledger's RLP deserialization code does not validate the length of the RLP list received,
and it may prematurely enter the signing flow when a APDU chunk boundary falls immediately
before the EIP-155 chain_id when deserializing a transaction. Since the chain_id is
uninitialized, it is 0 during this signing flow. This may cause the user to accidentally
sign the transaction with chain_id = 0. That signature would be returned from the device 1
packet earlier than expected by the communication loop. The device blocks the
second-to-last packet waiting for the signer flow, and then errors on the successive
packet (which contains the chain_id, zeroed r, and zeroed s)

Since the signature's early arrival causes successive errors during the communication
process, geth does not parse the improper signature produced by the device, and therefore
no improperly-signed transaction can be created. User funds are not at risk.

We mitigate by selecting the highest chunk size that leaves at least 4 bytes in the
final chunk.
… (#26698)

This ensures the "withdrawals" field will always be present in responses
to getPayloadBodiesByRangeV1 and getPayloadBodiesByHashV1.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
Conflicts/build failures resolved:
setHeadBeyondRoot call site had minor change of header.NumberU64() to
head.Number.Uint64(), was missing arbitrum SnapshotRestoreMaxGas and
diskRootFound return. Added it back in.

Many minor changes of header.NumberU64() to head.Number.Uint64().

ethapi.Backend changed 	CurrentBlock() return from *types.Block to
*types.Header, updated NodeInterfaceBackendAPI

types.TxData interface adds effectiveGasPrice, placeholders currently
for arb txs.

flatCallTracer is missing various arbitrum tracers.Tracer methods, added stubs.
@Tristan-Wilson
Copy link
Member Author

Upstream introduced the flock dependency ethereum/go-ethereum#26633 and currently this is causing the Nitro build to fail because it seems like various platform specific syscall definitions are not implemented for GOOS=js.

$ GOOS=js GOARCH=wasm go build -o target/tmp/replay.wasm ./cmd/replay/...
# github.com/gofrs/flock
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:28:30: undefined: syscall.LOCK_EX
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:39:30: undefined: syscall.LOCK_SH
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:57:20: undefined: syscall.Flock
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:67:20: undefined: syscall.Flock
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:97:20: undefined: syscall.Flock
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:97:50: undefined: syscall.LOCK_UN
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:119:29: undefined: syscall.LOCK_EX
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:131:29: undefined: syscall.LOCK_SH
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:151:17: undefined: syscall.Flock
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:151:52: undefined: syscall.LOCK_NB
../../go/pkg/mod/github.com/gofrs/flock@v0.8.1/flock_unix.go:151:52: too many errors

I haven't decided what to do yet. One of the options would be to roll back the introduction of flock in our fork.

Tristan-Wilson added a commit to OffchainLabs/nitro that referenced this pull request May 11, 2023
Most of the changes were related to to upstream's change of CurrentBlock
to return a *types.Header instead of *types.Block.

The build is currently failing due to the issue mentioned here:
OffchainLabs/go-ethereum#218 (comment)
@Tristan-Wilson
Copy link
Member Author

Looking through the flock source https://github.com/gofrs/flock, there's no implementation which makes sense for GOOS=js, so I'll see about removing the dependency from our fork.

@Tristan-Wilson
Copy link
Member Author

This fails with a similar error if I revert 09a9ccd, which uses tsdb

GOOS=js GOARCH=wasm go build -o target/tmp/replay.wasm ./cmd/replay/...
package github.com/offchainlabs/nitro/cmd/replay
        imports github.com/ethereum/go-ethereum/consensus
        imports github.com/ethereum/go-ethereum/core/rawdb
        imports github.com/prometheus/tsdb/fileutil
        imports golang.org/x/sys/unix: build constraints exclude all Go files in /home/tristan/go/pkg/mod/golang.org/x/sys@v0.6.0/unix

@Tristan-Wilson
Copy link
Member Author

Looks like we already fixed this in #19 and I accidentally removed it during the merge, will bring it back in.

This is copying the form of
#19 but using flock
instead of tsdb/fileutil as it is preferred by upstream.
call.go has the exact command to use to regenerate this file
//go:generate go run github.com/fjl/gencodec -type callFrame
-field-override callFrameMarshaling -out gen_callframe_json.go
Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly LGTM - I highlighted two areas for review by @PlasmaPower, and one comment in receipt.go

@@ -100,6 +100,13 @@ func (tx *ArbitrumUnsignedTx) setSignatureValues(chainID, v, r, s *big.Int) {

}

func (tx *ArbitrumUnsignedTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all these specifically I'd like @PlasmaPower to review

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These LGTM as they match behavior with the gasFeeCap() and gasTipCap() impls which say that these txs only specify a fee cap and have a tip cap of zero. That means they'll always just pay the basefee.

@@ -19,12 +19,13 @@

package rawdb

import "github.com/prometheus/tsdb/fileutil"
import "github.com/gofrs/flock"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this LGTM, but @PlasmaPower should also review

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- longer term we might want to move the FileLock interface to a common file between this and filelock_mock.go but no need to make that change now

// block location fields
rs[i].BlockHash = hash
rs[i].BlockNumber = new(big.Int).SetUint64(number)
rs[i].TransactionIndex = uint(i)

if rs[i].Type != ArbitrumLegacyTxType {
// The contract address can be derived from the transaction itself
if txs[i].To() == nil && rs[i].ContractAddress == (common.Address{}) {
if txs[i].To() == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to (and possibly cannot) recalculate ContractAddress if it is already filled (by decodeStoredReceiptRLP),

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see this doesn't happen for legacy Tx so I think we always can recalculate it.. question is if we always should

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the check back in, thanks for pointing this out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get this error from a nitro test when adding the check back in:

$ go test -run "TestContractTxDeploy" ./system_tests
...
    contract_tx_test.go:102:  [expected address 0x0000000000000000000000000000123412341234 nonce 0 to deploy to 0x733A0385EB916548E1a2087F038f0dE75043bEF7 but got 0x0000000000000000000000000000000000000000] 

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is already inside this if statement, so adding it back into the upper if statement would change behavior by causing it to set ContractAddress to empty if it was previously set. So I think this code is good as-is.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah, I see that inner if statement was added recently. Makes sense :)

Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PlasmaPower PlasmaPower merged commit 9aced57 into master Jun 6, 2023
@PlasmaPower PlasmaPower deleted the merge-v1.11.3 branch June 6, 2023 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.