Merge branch 'master' into upgrade_blobpool

This commit is contained in:
maskpp 2025-08-06 09:55:44 +08:00 committed by GitHub
commit 344720f94e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
254 changed files with 11614 additions and 1920 deletions

View file

@ -1,8 +1,13 @@
on: on:
schedule:
- cron: '0 15 * * *'
workflow_dispatch: workflow_dispatch:
### Note we cannot use cron-triggered builds right now, Gitea seems to have
### a few bugs in that area. So this workflow is scheduled using an external
### triggering mechanism and workflow_dispatch.
#
# schedule:
# - cron: '0 15 * * *'
jobs: jobs:
azure-cleanup: azure-cleanup:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -1,11 +1,17 @@
on: on:
schedule:
- cron: '0 16 * * *'
push: push:
tags: tags:
- "v*" - "v*"
workflow_dispatch: workflow_dispatch:
### Note we cannot use cron-triggered builds right now, Gitea seems to have
### a few bugs in that area. So this workflow is scheduled using an external
### triggering mechanism and workflow_dispatch.
#
# schedule:
# - cron: '0 16 * * *'
jobs: jobs:
ppa: ppa:
name: PPA Upload name: PPA Upload

View file

@ -4,6 +4,7 @@ on:
- "master" - "master"
tags: tags:
- "v*" - "v*"
workflow_dispatch:
jobs: jobs:
linux-intel: linux-intel:
@ -25,7 +26,7 @@ jobs:
- name: Build (amd64) - name: Build (amd64)
run: | run: |
go run build/ci.go install -arch amd64 -dlgo go run build/ci.go install -static -arch amd64 -dlgo
- name: Create/upload archive (amd64) - name: Create/upload archive (amd64)
run: | run: |
@ -37,7 +38,7 @@ jobs:
- name: Build (386) - name: Build (386)
run: | run: |
go run build/ci.go install -arch 386 -dlgo go run build/ci.go install -static -arch 386 -dlgo
- name: Create/upload archive (386) - name: Create/upload archive (386)
run: | run: |
@ -67,7 +68,7 @@ jobs:
- name: Build (arm64) - name: Build (arm64)
run: | run: |
go run build/ci.go install -dlgo -arch arm64 -cc aarch64-linux-gnu-gcc go run build/ci.go install -static -dlgo -arch arm64 -cc aarch64-linux-gnu-gcc
- name: Create/upload archive (arm64) - name: Create/upload archive (arm64)
run: | run: |
@ -79,7 +80,7 @@ jobs:
- name: Run build (arm5) - name: Run build (arm5)
run: | run: |
go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabi-gcc go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
env: env:
GOARM: "5" GOARM: "5"
@ -93,7 +94,7 @@ jobs:
- name: Run build (arm6) - name: Run build (arm6)
run: | run: |
go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabi-gcc go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
env: env:
GOARM: "6" GOARM: "6"
@ -108,7 +109,7 @@ jobs:
- name: Run build (arm7) - name: Run build (arm7)
run: | run: |
go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabi-gcc go run build/ci.go install -static -dlgo -arch arm -cc arm-linux-gnueabi-gcc
env: env:
GOARM: "7" GOARM: "7"
@ -121,6 +122,37 @@ jobs:
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }} LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }} AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
windows:
name: Windows Build
runs-on: "win-11"
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
# Note: gcc.exe only works properly if the corresponding bin/ directory is
# contained in PATH.
- name: "Build (amd64)"
shell: cmd
run: |
set PATH=%GETH_MINGW%\bin;%PATH%
go run build/ci.go install -dlgo -arch amd64 -cc %GETH_MINGW%\bin\gcc.exe
env:
GETH_MINGW: 'C:\msys64\mingw64'
- name: "Build (386)"
shell: cmd
run: |
set PATH=%GETH_MINGW%\bin;%PATH%
go run build/ci.go install -dlgo -arch 386 -cc %GETH_MINGW%\bin\gcc.exe
env:
GETH_MINGW: 'C:\msys64\mingw32'
docker: docker:
name: Docker Image name: Docker Image
runs-on: ubuntu-latest runs-on: ubuntu-latest

2
.github/CODEOWNERS vendored
View file

@ -29,5 +29,5 @@ miner/ @MariusVanDerWijden @fjl @rjl493456442
node/ @fjl node/ @fjl
p2p/ @fjl @zsfelfoldi p2p/ @fjl @zsfelfoldi
rlp/ @fjl rlp/ @fjl
params/ @fjl @karalabe @gballet @rjl493456442 @zsfelfoldi params/ @fjl @gballet @rjl493456442 @zsfelfoldi
rpc/ @fjl rpc/ @fjl

View file

@ -1,18 +1,20 @@
name: i386 linux tests
on: on:
push: push:
branches: [ master ] branches:
- master
pull_request: pull_request:
branches: [ master ] branches:
- master
workflow_dispatch: workflow_dispatch:
jobs: jobs:
lint: lint:
name: Lint name: Lint
runs-on: self-hosted runs-on: self-hosted-ghr
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
submodules: false
# Cache build tools to avoid downloading them each time # Cache build tools to avoid downloading them each time
- uses: actions/cache@v4 - uses: actions/cache@v4
@ -23,7 +25,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: 1.23.0 go-version: 1.24
cache: false cache: false
- name: Run linters - name: Run linters
@ -32,17 +34,25 @@ jobs:
go run build/ci.go check_generate go run build/ci.go check_generate
go run build/ci.go check_baddeps go run build/ci.go check_baddeps
build: test:
runs-on: self-hosted name: Test
needs: lint
runs-on: self-hosted-ghr
strategy:
matrix:
go:
- '1.24'
- '1.23'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
submodules: true
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: 1.24.0 go-version: ${{ matrix.go }}
cache: false cache: false
- name: Run tests - name: Run tests
run: go test -short ./... run: go test ./...
env:
GOOS: linux
GOARCH: 386

View file

@ -33,6 +33,10 @@ import (
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
) )
var (
intRegex = regexp.MustCompile(`(u)?int([0-9]*)`)
)
func isKeyWord(arg string) bool { func isKeyWord(arg string) bool {
switch arg { switch arg {
case "break": case "break":
@ -299,7 +303,7 @@ func bindBasicType(kind abi.Type) string {
case abi.AddressTy: case abi.AddressTy:
return "common.Address" return "common.Address"
case abi.IntTy, abi.UintTy: case abi.IntTy, abi.UintTy:
parts := regexp.MustCompile(`(u)?int([0-9]*)`).FindStringSubmatch(kind.String()) parts := intRegex.FindStringSubmatch(kind.String())
switch parts[2] { switch parts[2] {
case "8", "16", "32", "64": case "8", "16", "32", "64":
return fmt.Sprintf("%sint%s", parts[1], parts[2]) return fmt.Sprintf("%sint%s", parts[1], parts[2])

View file

@ -281,7 +281,7 @@ func TestBindingV2ConvertedV1Tests(t *testing.T) {
} }
// Set this environment variable to regenerate the test outputs. // Set this environment variable to regenerate the test outputs.
if os.Getenv("WRITE_TEST_FILES") != "" { if os.Getenv("WRITE_TEST_FILES") != "" {
if err := os.WriteFile((fname), []byte(have), 0666); err != nil { if err := os.WriteFile(fname, []byte(have), 0666); err != nil {
t.Fatalf("err writing expected output to file: %v\n", err) t.Fatalf("err writing expected output to file: %v\n", err)
} }
} }

View file

@ -90,7 +90,8 @@ var (
{{range .Calls}} {{range .Calls}}
// Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling // Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x{{printf "%x" .Original.ID}}. // the contract method with ID 0x{{printf "%x" .Original.ID}}. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: {{.Original.String}} // Solidity: {{.Original.String}}
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Pack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte { func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Pack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte {
@ -101,6 +102,15 @@ var (
return enc return enc
} }
// TryPack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x{{printf "%x" .Original.ID}}. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: {{.Original.String}}
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) TryPack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) ([]byte, error) {
return {{ decapitalise $contract.Type}}.abi.Pack("{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}})
}
{{/* Unpack method is needed only when there are return args */}} {{/* Unpack method is needed only when there are return args */}}
{{if .Normalized.Outputs }} {{if .Normalized.Outputs }}
{{ if .Structured }} {{ if .Structured }}
@ -133,8 +143,7 @@ var (
outstruct.{{capitalise .Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) outstruct.{{capitalise .Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}})
{{- end }} {{- end }}
{{- end }} {{- end }}
return *outstruct, err return *outstruct, nil{{else}}
{{else}}
if err != nil { if err != nil {
return {{range $i, $_ := .Normalized.Outputs}}{{if ispointertype .Type}}new({{underlyingbindtype .Type }}), {{else}}*new({{bindtype .Type $structs}}), {{end}}{{end}} err return {{range $i, $_ := .Normalized.Outputs}}{{if ispointertype .Type}}new({{underlyingbindtype .Type }}), {{else}}*new({{bindtype .Type $structs}}), {{end}}{{end}} err
} }
@ -145,8 +154,8 @@ var (
out{{$i}} := *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}}) out{{$i}} := *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}})
{{- end }} {{- end }}
{{- end}} {{- end}}
return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} err return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} nil
{{- end}} {{- end}}
} }
{{end}} {{end}}
{{end}} {{end}}

View file

@ -52,7 +52,8 @@ func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Addre
} }
// PackTest is the Go binding used to pack the parameters required for calling // PackTest is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd7a5aba2. // the contract method with ID 0xd7a5aba2. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function test(function callback) returns() // Solidity: function test(function callback) returns()
func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte { func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte {
@ -62,3 +63,12 @@ func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte {
} }
return enc return enc
} }
// TryPackTest is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd7a5aba2. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function test(function callback) returns()
func (callbackParam *CallbackParam) TryPackTest(callback [24]byte) ([]byte, error) {
return callbackParam.abi.Pack("test", callback)
}

View file

@ -64,7 +64,8 @@ func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, f
} }
// PackAmountRaised is the Go binding used to pack the parameters required for calling // PackAmountRaised is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x7b3e5e7b. // the contract method with ID 0x7b3e5e7b. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function amountRaised() returns(uint256) // Solidity: function amountRaised() returns(uint256)
func (crowdsale *Crowdsale) PackAmountRaised() []byte { func (crowdsale *Crowdsale) PackAmountRaised() []byte {
@ -75,6 +76,15 @@ func (crowdsale *Crowdsale) PackAmountRaised() []byte {
return enc return enc
} }
// TryPackAmountRaised is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x7b3e5e7b. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function amountRaised() returns(uint256)
func (crowdsale *Crowdsale) TryPackAmountRaised() ([]byte, error) {
return crowdsale.abi.Pack("amountRaised")
}
// UnpackAmountRaised is the Go binding that unpacks the parameters returned // UnpackAmountRaised is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x7b3e5e7b. // from invoking the contract method with ID 0x7b3e5e7b.
// //
@ -85,11 +95,12 @@ func (crowdsale *Crowdsale) UnpackAmountRaised(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackBeneficiary is the Go binding used to pack the parameters required for calling // PackBeneficiary is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x38af3eed. // the contract method with ID 0x38af3eed. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function beneficiary() returns(address) // Solidity: function beneficiary() returns(address)
func (crowdsale *Crowdsale) PackBeneficiary() []byte { func (crowdsale *Crowdsale) PackBeneficiary() []byte {
@ -100,6 +111,15 @@ func (crowdsale *Crowdsale) PackBeneficiary() []byte {
return enc return enc
} }
// TryPackBeneficiary is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x38af3eed. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function beneficiary() returns(address)
func (crowdsale *Crowdsale) TryPackBeneficiary() ([]byte, error) {
return crowdsale.abi.Pack("beneficiary")
}
// UnpackBeneficiary is the Go binding that unpacks the parameters returned // UnpackBeneficiary is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x38af3eed. // from invoking the contract method with ID 0x38af3eed.
// //
@ -110,11 +130,12 @@ func (crowdsale *Crowdsale) UnpackBeneficiary(data []byte) (common.Address, erro
return *new(common.Address), err return *new(common.Address), err
} }
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err return out0, nil
} }
// PackCheckGoalReached is the Go binding used to pack the parameters required for calling // PackCheckGoalReached is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x01cb3b20. // the contract method with ID 0x01cb3b20. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function checkGoalReached() returns() // Solidity: function checkGoalReached() returns()
func (crowdsale *Crowdsale) PackCheckGoalReached() []byte { func (crowdsale *Crowdsale) PackCheckGoalReached() []byte {
@ -125,8 +146,18 @@ func (crowdsale *Crowdsale) PackCheckGoalReached() []byte {
return enc return enc
} }
// TryPackCheckGoalReached is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x01cb3b20. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function checkGoalReached() returns()
func (crowdsale *Crowdsale) TryPackCheckGoalReached() ([]byte, error) {
return crowdsale.abi.Pack("checkGoalReached")
}
// PackDeadline is the Go binding used to pack the parameters required for calling // PackDeadline is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x29dcb0cf. // the contract method with ID 0x29dcb0cf. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function deadline() returns(uint256) // Solidity: function deadline() returns(uint256)
func (crowdsale *Crowdsale) PackDeadline() []byte { func (crowdsale *Crowdsale) PackDeadline() []byte {
@ -137,6 +168,15 @@ func (crowdsale *Crowdsale) PackDeadline() []byte {
return enc return enc
} }
// TryPackDeadline is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x29dcb0cf. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function deadline() returns(uint256)
func (crowdsale *Crowdsale) TryPackDeadline() ([]byte, error) {
return crowdsale.abi.Pack("deadline")
}
// UnpackDeadline is the Go binding that unpacks the parameters returned // UnpackDeadline is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x29dcb0cf. // from invoking the contract method with ID 0x29dcb0cf.
// //
@ -147,11 +187,12 @@ func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackFunders is the Go binding used to pack the parameters required for calling // PackFunders is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xdc0d3dff. // the contract method with ID 0xdc0d3dff. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount) // Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte { func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte {
@ -162,6 +203,15 @@ func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte {
return enc return enc
} }
// TryPackFunders is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xdc0d3dff. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
func (crowdsale *Crowdsale) TryPackFunders(arg0 *big.Int) ([]byte, error) {
return crowdsale.abi.Pack("funders", arg0)
}
// FundersOutput serves as a container for the return parameters of contract // FundersOutput serves as a container for the return parameters of contract
// method Funders. // method Funders.
type FundersOutput struct { type FundersOutput struct {
@ -181,12 +231,12 @@ func (crowdsale *Crowdsale) UnpackFunders(data []byte) (FundersOutput, error) {
} }
outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackFundingGoal is the Go binding used to pack the parameters required for calling // PackFundingGoal is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x7a3a0e84. // the contract method with ID 0x7a3a0e84. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function fundingGoal() returns(uint256) // Solidity: function fundingGoal() returns(uint256)
func (crowdsale *Crowdsale) PackFundingGoal() []byte { func (crowdsale *Crowdsale) PackFundingGoal() []byte {
@ -197,6 +247,15 @@ func (crowdsale *Crowdsale) PackFundingGoal() []byte {
return enc return enc
} }
// TryPackFundingGoal is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x7a3a0e84. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function fundingGoal() returns(uint256)
func (crowdsale *Crowdsale) TryPackFundingGoal() ([]byte, error) {
return crowdsale.abi.Pack("fundingGoal")
}
// UnpackFundingGoal is the Go binding that unpacks the parameters returned // UnpackFundingGoal is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x7a3a0e84. // from invoking the contract method with ID 0x7a3a0e84.
// //
@ -207,11 +266,12 @@ func (crowdsale *Crowdsale) UnpackFundingGoal(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackPrice is the Go binding used to pack the parameters required for calling // PackPrice is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xa035b1fe. // the contract method with ID 0xa035b1fe. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function price() returns(uint256) // Solidity: function price() returns(uint256)
func (crowdsale *Crowdsale) PackPrice() []byte { func (crowdsale *Crowdsale) PackPrice() []byte {
@ -222,6 +282,15 @@ func (crowdsale *Crowdsale) PackPrice() []byte {
return enc return enc
} }
// TryPackPrice is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xa035b1fe. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function price() returns(uint256)
func (crowdsale *Crowdsale) TryPackPrice() ([]byte, error) {
return crowdsale.abi.Pack("price")
}
// UnpackPrice is the Go binding that unpacks the parameters returned // UnpackPrice is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xa035b1fe. // from invoking the contract method with ID 0xa035b1fe.
// //
@ -232,11 +301,12 @@ func (crowdsale *Crowdsale) UnpackPrice(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackTokenReward is the Go binding used to pack the parameters required for calling // PackTokenReward is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x6e66f6e9. // the contract method with ID 0x6e66f6e9. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function tokenReward() returns(address) // Solidity: function tokenReward() returns(address)
func (crowdsale *Crowdsale) PackTokenReward() []byte { func (crowdsale *Crowdsale) PackTokenReward() []byte {
@ -247,6 +317,15 @@ func (crowdsale *Crowdsale) PackTokenReward() []byte {
return enc return enc
} }
// TryPackTokenReward is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x6e66f6e9. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function tokenReward() returns(address)
func (crowdsale *Crowdsale) TryPackTokenReward() ([]byte, error) {
return crowdsale.abi.Pack("tokenReward")
}
// UnpackTokenReward is the Go binding that unpacks the parameters returned // UnpackTokenReward is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x6e66f6e9. // from invoking the contract method with ID 0x6e66f6e9.
// //
@ -257,7 +336,7 @@ func (crowdsale *Crowdsale) UnpackTokenReward(data []byte) (common.Address, erro
return *new(common.Address), err return *new(common.Address), err
} }
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err return out0, nil
} }
// CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract. // CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract.

View file

@ -64,7 +64,8 @@ func (dAO *DAO) PackConstructor(minimumQuorumForProposals *big.Int, minutesForDe
} }
// PackChangeMembership is the Go binding used to pack the parameters required for calling // PackChangeMembership is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x9644fcbd. // the contract method with ID 0x9644fcbd. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns() // Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns()
func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, memberName string) []byte { func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool, memberName string) []byte {
@ -75,8 +76,18 @@ func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool,
return enc return enc
} }
// TryPackChangeMembership is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x9644fcbd. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function changeMembership(address targetMember, bool canVote, string memberName) returns()
func (dAO *DAO) TryPackChangeMembership(targetMember common.Address, canVote bool, memberName string) ([]byte, error) {
return dAO.abi.Pack("changeMembership", targetMember, canVote, memberName)
}
// PackChangeVotingRules is the Go binding used to pack the parameters required for calling // PackChangeVotingRules is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xbcca1fd3. // the contract method with ID 0xbcca1fd3. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns() // Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns()
func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) []byte { func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) []byte {
@ -87,8 +98,18 @@ func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minute
return enc return enc
} }
// TryPackChangeVotingRules is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xbcca1fd3. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns()
func (dAO *DAO) TryPackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) ([]byte, error) {
return dAO.abi.Pack("changeVotingRules", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority)
}
// PackCheckProposalCode is the Go binding used to pack the parameters required for calling // PackCheckProposalCode is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xeceb2945. // the contract method with ID 0xeceb2945. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut) // Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut)
func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) []byte { func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) []byte {
@ -99,6 +120,15 @@ func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary commo
return enc return enc
} }
// TryPackCheckProposalCode is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xeceb2945. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut)
func (dAO *DAO) TryPackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) ([]byte, error) {
return dAO.abi.Pack("checkProposalCode", proposalNumber, beneficiary, etherAmount, transactionBytecode)
}
// UnpackCheckProposalCode is the Go binding that unpacks the parameters returned // UnpackCheckProposalCode is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xeceb2945. // from invoking the contract method with ID 0xeceb2945.
// //
@ -109,11 +139,12 @@ func (dAO *DAO) UnpackCheckProposalCode(data []byte) (bool, error) {
return *new(bool), err return *new(bool), err
} }
out0 := *abi.ConvertType(out[0], new(bool)).(*bool) out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
return out0, err return out0, nil
} }
// PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling // PackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x69bd3436. // the contract method with ID 0x69bd3436. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function debatingPeriodInMinutes() returns(uint256) // Solidity: function debatingPeriodInMinutes() returns(uint256)
func (dAO *DAO) PackDebatingPeriodInMinutes() []byte { func (dAO *DAO) PackDebatingPeriodInMinutes() []byte {
@ -124,6 +155,15 @@ func (dAO *DAO) PackDebatingPeriodInMinutes() []byte {
return enc return enc
} }
// TryPackDebatingPeriodInMinutes is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x69bd3436. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function debatingPeriodInMinutes() returns(uint256)
func (dAO *DAO) TryPackDebatingPeriodInMinutes() ([]byte, error) {
return dAO.abi.Pack("debatingPeriodInMinutes")
}
// UnpackDebatingPeriodInMinutes is the Go binding that unpacks the parameters returned // UnpackDebatingPeriodInMinutes is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x69bd3436. // from invoking the contract method with ID 0x69bd3436.
// //
@ -134,11 +174,12 @@ func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackExecuteProposal is the Go binding used to pack the parameters required for calling // PackExecuteProposal is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x237e9492. // the contract method with ID 0x237e9492. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result) // Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result)
func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) []byte { func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) []byte {
@ -149,6 +190,15 @@ func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode
return enc return enc
} }
// TryPackExecuteProposal is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x237e9492. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result)
func (dAO *DAO) TryPackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) ([]byte, error) {
return dAO.abi.Pack("executeProposal", proposalNumber, transactionBytecode)
}
// UnpackExecuteProposal is the Go binding that unpacks the parameters returned // UnpackExecuteProposal is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x237e9492. // from invoking the contract method with ID 0x237e9492.
// //
@ -159,11 +209,12 @@ func (dAO *DAO) UnpackExecuteProposal(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackMajorityMargin is the Go binding used to pack the parameters required for calling // PackMajorityMargin is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xaa02a90f. // the contract method with ID 0xaa02a90f. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function majorityMargin() returns(int256) // Solidity: function majorityMargin() returns(int256)
func (dAO *DAO) PackMajorityMargin() []byte { func (dAO *DAO) PackMajorityMargin() []byte {
@ -174,6 +225,15 @@ func (dAO *DAO) PackMajorityMargin() []byte {
return enc return enc
} }
// TryPackMajorityMargin is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xaa02a90f. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function majorityMargin() returns(int256)
func (dAO *DAO) TryPackMajorityMargin() ([]byte, error) {
return dAO.abi.Pack("majorityMargin")
}
// UnpackMajorityMargin is the Go binding that unpacks the parameters returned // UnpackMajorityMargin is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xaa02a90f. // from invoking the contract method with ID 0xaa02a90f.
// //
@ -184,11 +244,12 @@ func (dAO *DAO) UnpackMajorityMargin(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackMemberId is the Go binding used to pack the parameters required for calling // PackMemberId is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x39106821. // the contract method with ID 0x39106821. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function memberId(address ) returns(uint256) // Solidity: function memberId(address ) returns(uint256)
func (dAO *DAO) PackMemberId(arg0 common.Address) []byte { func (dAO *DAO) PackMemberId(arg0 common.Address) []byte {
@ -199,6 +260,15 @@ func (dAO *DAO) PackMemberId(arg0 common.Address) []byte {
return enc return enc
} }
// TryPackMemberId is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x39106821. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function memberId(address ) returns(uint256)
func (dAO *DAO) TryPackMemberId(arg0 common.Address) ([]byte, error) {
return dAO.abi.Pack("memberId", arg0)
}
// UnpackMemberId is the Go binding that unpacks the parameters returned // UnpackMemberId is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x39106821. // from invoking the contract method with ID 0x39106821.
// //
@ -209,11 +279,12 @@ func (dAO *DAO) UnpackMemberId(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackMembers is the Go binding used to pack the parameters required for calling // PackMembers is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x5daf08ca. // the contract method with ID 0x5daf08ca. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) // Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince)
func (dAO *DAO) PackMembers(arg0 *big.Int) []byte { func (dAO *DAO) PackMembers(arg0 *big.Int) []byte {
@ -224,6 +295,15 @@ func (dAO *DAO) PackMembers(arg0 *big.Int) []byte {
return enc return enc
} }
// TryPackMembers is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x5daf08ca. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince)
func (dAO *DAO) TryPackMembers(arg0 *big.Int) ([]byte, error) {
return dAO.abi.Pack("members", arg0)
}
// MembersOutput serves as a container for the return parameters of contract // MembersOutput serves as a container for the return parameters of contract
// method Members. // method Members.
type MembersOutput struct { type MembersOutput struct {
@ -247,12 +327,12 @@ func (dAO *DAO) UnpackMembers(data []byte) (MembersOutput, error) {
outstruct.CanVote = *abi.ConvertType(out[1], new(bool)).(*bool) outstruct.CanVote = *abi.ConvertType(out[1], new(bool)).(*bool)
outstruct.Name = *abi.ConvertType(out[2], new(string)).(*string) outstruct.Name = *abi.ConvertType(out[2], new(string)).(*string)
outstruct.MemberSince = abi.ConvertType(out[3], new(big.Int)).(*big.Int) outstruct.MemberSince = abi.ConvertType(out[3], new(big.Int)).(*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackMinimumQuorum is the Go binding used to pack the parameters required for calling // PackMinimumQuorum is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x8160f0b5. // the contract method with ID 0x8160f0b5. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function minimumQuorum() returns(uint256) // Solidity: function minimumQuorum() returns(uint256)
func (dAO *DAO) PackMinimumQuorum() []byte { func (dAO *DAO) PackMinimumQuorum() []byte {
@ -263,6 +343,15 @@ func (dAO *DAO) PackMinimumQuorum() []byte {
return enc return enc
} }
// TryPackMinimumQuorum is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x8160f0b5. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function minimumQuorum() returns(uint256)
func (dAO *DAO) TryPackMinimumQuorum() ([]byte, error) {
return dAO.abi.Pack("minimumQuorum")
}
// UnpackMinimumQuorum is the Go binding that unpacks the parameters returned // UnpackMinimumQuorum is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x8160f0b5. // from invoking the contract method with ID 0x8160f0b5.
// //
@ -273,11 +362,12 @@ func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackNewProposal is the Go binding used to pack the parameters required for calling // PackNewProposal is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xb1050da5. // the contract method with ID 0xb1050da5. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) // Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID)
func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) []byte { func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) []byte {
@ -288,6 +378,15 @@ func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int
return enc return enc
} }
// TryPackNewProposal is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xb1050da5. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID)
func (dAO *DAO) TryPackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) ([]byte, error) {
return dAO.abi.Pack("newProposal", beneficiary, etherAmount, jobDescription, transactionBytecode)
}
// UnpackNewProposal is the Go binding that unpacks the parameters returned // UnpackNewProposal is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xb1050da5. // from invoking the contract method with ID 0xb1050da5.
// //
@ -298,11 +397,12 @@ func (dAO *DAO) UnpackNewProposal(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackNumProposals is the Go binding used to pack the parameters required for calling // PackNumProposals is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x400e3949. // the contract method with ID 0x400e3949. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function numProposals() returns(uint256) // Solidity: function numProposals() returns(uint256)
func (dAO *DAO) PackNumProposals() []byte { func (dAO *DAO) PackNumProposals() []byte {
@ -313,6 +413,15 @@ func (dAO *DAO) PackNumProposals() []byte {
return enc return enc
} }
// TryPackNumProposals is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x400e3949. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function numProposals() returns(uint256)
func (dAO *DAO) TryPackNumProposals() ([]byte, error) {
return dAO.abi.Pack("numProposals")
}
// UnpackNumProposals is the Go binding that unpacks the parameters returned // UnpackNumProposals is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x400e3949. // from invoking the contract method with ID 0x400e3949.
// //
@ -323,11 +432,12 @@ func (dAO *DAO) UnpackNumProposals(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackOwner is the Go binding used to pack the parameters required for calling // PackOwner is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x8da5cb5b. // the contract method with ID 0x8da5cb5b. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function owner() returns(address) // Solidity: function owner() returns(address)
func (dAO *DAO) PackOwner() []byte { func (dAO *DAO) PackOwner() []byte {
@ -338,6 +448,15 @@ func (dAO *DAO) PackOwner() []byte {
return enc return enc
} }
// TryPackOwner is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x8da5cb5b. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function owner() returns(address)
func (dAO *DAO) TryPackOwner() ([]byte, error) {
return dAO.abi.Pack("owner")
}
// UnpackOwner is the Go binding that unpacks the parameters returned // UnpackOwner is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x8da5cb5b. // from invoking the contract method with ID 0x8da5cb5b.
// //
@ -348,11 +467,12 @@ func (dAO *DAO) UnpackOwner(data []byte) (common.Address, error) {
return *new(common.Address), err return *new(common.Address), err
} }
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, err return out0, nil
} }
// PackProposals is the Go binding used to pack the parameters required for calling // PackProposals is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x013cf08b. // the contract method with ID 0x013cf08b. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) // Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash)
func (dAO *DAO) PackProposals(arg0 *big.Int) []byte { func (dAO *DAO) PackProposals(arg0 *big.Int) []byte {
@ -363,6 +483,15 @@ func (dAO *DAO) PackProposals(arg0 *big.Int) []byte {
return enc return enc
} }
// TryPackProposals is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x013cf08b. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash)
func (dAO *DAO) TryPackProposals(arg0 *big.Int) ([]byte, error) {
return dAO.abi.Pack("proposals", arg0)
}
// ProposalsOutput serves as a container for the return parameters of contract // ProposalsOutput serves as a container for the return parameters of contract
// method Proposals. // method Proposals.
type ProposalsOutput struct { type ProposalsOutput struct {
@ -396,12 +525,12 @@ func (dAO *DAO) UnpackProposals(data []byte) (ProposalsOutput, error) {
outstruct.NumberOfVotes = abi.ConvertType(out[6], new(big.Int)).(*big.Int) outstruct.NumberOfVotes = abi.ConvertType(out[6], new(big.Int)).(*big.Int)
outstruct.CurrentResult = abi.ConvertType(out[7], new(big.Int)).(*big.Int) outstruct.CurrentResult = abi.ConvertType(out[7], new(big.Int)).(*big.Int)
outstruct.ProposalHash = *abi.ConvertType(out[8], new([32]byte)).(*[32]byte) outstruct.ProposalHash = *abi.ConvertType(out[8], new([32]byte)).(*[32]byte)
return *outstruct, err return *outstruct, nil
} }
// PackTransferOwnership is the Go binding used to pack the parameters required for calling // PackTransferOwnership is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xf2fde38b. // the contract method with ID 0xf2fde38b. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function transferOwnership(address newOwner) returns() // Solidity: function transferOwnership(address newOwner) returns()
func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte { func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte {
@ -412,8 +541,18 @@ func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte {
return enc return enc
} }
// TryPackTransferOwnership is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xf2fde38b. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function transferOwnership(address newOwner) returns()
func (dAO *DAO) TryPackTransferOwnership(newOwner common.Address) ([]byte, error) {
return dAO.abi.Pack("transferOwnership", newOwner)
}
// PackVote is the Go binding used to pack the parameters required for calling // PackVote is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd3c0715b. // the contract method with ID 0xd3c0715b. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) // Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID)
func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) []byte { func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) []byte {
@ -424,6 +563,15 @@ func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justifi
return enc return enc
} }
// TryPackVote is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd3c0715b. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID)
func (dAO *DAO) TryPackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) ([]byte, error) {
return dAO.abi.Pack("vote", proposalNumber, supportsProposal, justificationText)
}
// UnpackVote is the Go binding that unpacks the parameters returned // UnpackVote is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xd3c0715b. // from invoking the contract method with ID 0xd3c0715b.
// //
@ -434,7 +582,7 @@ func (dAO *DAO) UnpackVote(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// DAOChangeOfRules represents a ChangeOfRules event raised by the DAO contract. // DAOChangeOfRules represents a ChangeOfRules event raised by the DAO contract.

View file

@ -52,7 +52,8 @@ func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.A
} }
// PackDeepUint64Array is the Go binding used to pack the parameters required for calling // PackDeepUint64Array is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x98ed1856. // the contract method with ID 0x98ed1856. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64) // Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64)
func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) []byte { func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) []byte {
@ -63,6 +64,15 @@ func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, a
return enc return enc
} }
// TryPackDeepUint64Array is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x98ed1856. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64)
func (deeplyNestedArray *DeeplyNestedArray) TryPackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) ([]byte, error) {
return deeplyNestedArray.abi.Pack("deepUint64Array", arg0, arg1, arg2)
}
// UnpackDeepUint64Array is the Go binding that unpacks the parameters returned // UnpackDeepUint64Array is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x98ed1856. // from invoking the contract method with ID 0x98ed1856.
// //
@ -73,11 +83,12 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackDeepUint64Array(data []byte) (
return *new(uint64), err return *new(uint64), err
} }
out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)
return out0, err return out0, nil
} }
// PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling // PackRetrieveDeepArray is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x8ed4573a. // the contract method with ID 0x8ed4573a. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function retrieveDeepArray() view returns(uint64[3][4][5]) // Solidity: function retrieveDeepArray() view returns(uint64[3][4][5])
func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte { func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte {
@ -88,6 +99,15 @@ func (deeplyNestedArray *DeeplyNestedArray) PackRetrieveDeepArray() []byte {
return enc return enc
} }
// TryPackRetrieveDeepArray is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x8ed4573a. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function retrieveDeepArray() view returns(uint64[3][4][5])
func (deeplyNestedArray *DeeplyNestedArray) TryPackRetrieveDeepArray() ([]byte, error) {
return deeplyNestedArray.abi.Pack("retrieveDeepArray")
}
// UnpackRetrieveDeepArray is the Go binding that unpacks the parameters returned // UnpackRetrieveDeepArray is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x8ed4573a. // from invoking the contract method with ID 0x8ed4573a.
// //
@ -98,11 +118,12 @@ func (deeplyNestedArray *DeeplyNestedArray) UnpackRetrieveDeepArray(data []byte)
return *new([5][4][3]uint64), err return *new([5][4][3]uint64), err
} }
out0 := *abi.ConvertType(out[0], new([5][4][3]uint64)).(*[5][4][3]uint64) out0 := *abi.ConvertType(out[0], new([5][4][3]uint64)).(*[5][4][3]uint64)
return out0, err return out0, nil
} }
// PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling // PackStoreDeepUintArray is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x34424855. // the contract method with ID 0x34424855. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns() // Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns()
func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3]uint64) []byte { func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3]uint64) []byte {
@ -112,3 +133,12 @@ func (deeplyNestedArray *DeeplyNestedArray) PackStoreDeepUintArray(arr [5][4][3]
} }
return enc return enc
} }
// TryPackStoreDeepUintArray is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x34424855. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function storeDeepUintArray(uint64[3][4][5] arr) returns()
func (deeplyNestedArray *DeeplyNestedArray) TryPackStoreDeepUintArray(arr [5][4][3]uint64) ([]byte, error) {
return deeplyNestedArray.abi.Pack("storeDeepUintArray", arr)
}

View file

@ -52,7 +52,8 @@ func (c *Getter) Instance(backend bind.ContractBackend, addr common.Address) *bi
} }
// PackGetter is the Go binding used to pack the parameters required for calling // PackGetter is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x993a04b7. // the contract method with ID 0x993a04b7. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function getter() returns(string, int256, bytes32) // Solidity: function getter() returns(string, int256, bytes32)
func (getter *Getter) PackGetter() []byte { func (getter *Getter) PackGetter() []byte {
@ -63,6 +64,15 @@ func (getter *Getter) PackGetter() []byte {
return enc return enc
} }
// TryPackGetter is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x993a04b7. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function getter() returns(string, int256, bytes32)
func (getter *Getter) TryPackGetter() ([]byte, error) {
return getter.abi.Pack("getter")
}
// GetterOutput serves as a container for the return parameters of contract // GetterOutput serves as a container for the return parameters of contract
// method Getter. // method Getter.
type GetterOutput struct { type GetterOutput struct {
@ -84,6 +94,5 @@ func (getter *Getter) UnpackGetter(data []byte) (GetterOutput, error) {
outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string)
outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
outstruct.Arg2 = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) outstruct.Arg2 = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte)
return *outstruct, err return *outstruct, nil
} }

View file

@ -52,7 +52,8 @@ func (c *IdentifierCollision) Instance(backend bind.ContractBackend, addr common
} }
// PackMyVar is the Go binding used to pack the parameters required for calling // PackMyVar is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x4ef1f0ad. // the contract method with ID 0x4ef1f0ad. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function MyVar() view returns(uint256) // Solidity: function MyVar() view returns(uint256)
func (identifierCollision *IdentifierCollision) PackMyVar() []byte { func (identifierCollision *IdentifierCollision) PackMyVar() []byte {
@ -63,6 +64,15 @@ func (identifierCollision *IdentifierCollision) PackMyVar() []byte {
return enc return enc
} }
// TryPackMyVar is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x4ef1f0ad. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function MyVar() view returns(uint256)
func (identifierCollision *IdentifierCollision) TryPackMyVar() ([]byte, error) {
return identifierCollision.abi.Pack("MyVar")
}
// UnpackMyVar is the Go binding that unpacks the parameters returned // UnpackMyVar is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x4ef1f0ad. // from invoking the contract method with ID 0x4ef1f0ad.
// //
@ -73,11 +83,12 @@ func (identifierCollision *IdentifierCollision) UnpackMyVar(data []byte) (*big.I
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackPubVar is the Go binding used to pack the parameters required for calling // PackPubVar is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x01ad4d87. // the contract method with ID 0x01ad4d87. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function _myVar() view returns(uint256) // Solidity: function _myVar() view returns(uint256)
func (identifierCollision *IdentifierCollision) PackPubVar() []byte { func (identifierCollision *IdentifierCollision) PackPubVar() []byte {
@ -88,6 +99,15 @@ func (identifierCollision *IdentifierCollision) PackPubVar() []byte {
return enc return enc
} }
// TryPackPubVar is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x01ad4d87. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function _myVar() view returns(uint256)
func (identifierCollision *IdentifierCollision) TryPackPubVar() ([]byte, error) {
return identifierCollision.abi.Pack("_myVar")
}
// UnpackPubVar is the Go binding that unpacks the parameters returned // UnpackPubVar is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x01ad4d87. // from invoking the contract method with ID 0x01ad4d87.
// //
@ -98,5 +118,5 @@ func (identifierCollision *IdentifierCollision) UnpackPubVar(data []byte) (*big.
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }

View file

@ -51,7 +51,8 @@ func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Addres
} }
// PackAnonInput is the Go binding used to pack the parameters required for calling // PackAnonInput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x3e708e82. // the contract method with ID 0x3e708e82. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function anonInput(string ) returns() // Solidity: function anonInput(string ) returns()
func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte { func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte {
@ -62,8 +63,18 @@ func (inputChecker *InputChecker) PackAnonInput(arg0 string) []byte {
return enc return enc
} }
// TryPackAnonInput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x3e708e82. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function anonInput(string ) returns()
func (inputChecker *InputChecker) TryPackAnonInput(arg0 string) ([]byte, error) {
return inputChecker.abi.Pack("anonInput", arg0)
}
// PackAnonInputs is the Go binding used to pack the parameters required for calling // PackAnonInputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x28160527. // the contract method with ID 0x28160527. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function anonInputs(string , string ) returns() // Solidity: function anonInputs(string , string ) returns()
func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byte { func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byte {
@ -74,8 +85,18 @@ func (inputChecker *InputChecker) PackAnonInputs(arg0 string, arg1 string) []byt
return enc return enc
} }
// TryPackAnonInputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x28160527. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function anonInputs(string , string ) returns()
func (inputChecker *InputChecker) TryPackAnonInputs(arg0 string, arg1 string) ([]byte, error) {
return inputChecker.abi.Pack("anonInputs", arg0, arg1)
}
// PackMixedInputs is the Go binding used to pack the parameters required for calling // PackMixedInputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xc689ebdc. // the contract method with ID 0xc689ebdc. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function mixedInputs(string , string str) returns() // Solidity: function mixedInputs(string , string str) returns()
func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byte { func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byte {
@ -86,8 +107,18 @@ func (inputChecker *InputChecker) PackMixedInputs(arg0 string, str string) []byt
return enc return enc
} }
// TryPackMixedInputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xc689ebdc. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function mixedInputs(string , string str) returns()
func (inputChecker *InputChecker) TryPackMixedInputs(arg0 string, str string) ([]byte, error) {
return inputChecker.abi.Pack("mixedInputs", arg0, str)
}
// PackNamedInput is the Go binding used to pack the parameters required for calling // PackNamedInput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x0d402005. // the contract method with ID 0x0d402005. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function namedInput(string str) returns() // Solidity: function namedInput(string str) returns()
func (inputChecker *InputChecker) PackNamedInput(str string) []byte { func (inputChecker *InputChecker) PackNamedInput(str string) []byte {
@ -98,8 +129,18 @@ func (inputChecker *InputChecker) PackNamedInput(str string) []byte {
return enc return enc
} }
// TryPackNamedInput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x0d402005. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function namedInput(string str) returns()
func (inputChecker *InputChecker) TryPackNamedInput(str string) ([]byte, error) {
return inputChecker.abi.Pack("namedInput", str)
}
// PackNamedInputs is the Go binding used to pack the parameters required for calling // PackNamedInputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x63c796ed. // the contract method with ID 0x63c796ed. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function namedInputs(string str1, string str2) returns() // Solidity: function namedInputs(string str1, string str2) returns()
func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []byte { func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []byte {
@ -110,8 +151,18 @@ func (inputChecker *InputChecker) PackNamedInputs(str1 string, str2 string) []by
return enc return enc
} }
// TryPackNamedInputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x63c796ed. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function namedInputs(string str1, string str2) returns()
func (inputChecker *InputChecker) TryPackNamedInputs(str1 string, str2 string) ([]byte, error) {
return inputChecker.abi.Pack("namedInputs", str1, str2)
}
// PackNoInput is the Go binding used to pack the parameters required for calling // PackNoInput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x53539029. // the contract method with ID 0x53539029. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function noInput() returns() // Solidity: function noInput() returns()
func (inputChecker *InputChecker) PackNoInput() []byte { func (inputChecker *InputChecker) PackNoInput() []byte {
@ -121,3 +172,12 @@ func (inputChecker *InputChecker) PackNoInput() []byte {
} }
return enc return enc
} }
// TryPackNoInput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x53539029. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function noInput() returns()
func (inputChecker *InputChecker) TryPackNoInput() ([]byte, error) {
return inputChecker.abi.Pack("noInput")
}

View file

@ -64,7 +64,8 @@ func (interactor *Interactor) PackConstructor(str string) []byte {
} }
// PackDeployString is the Go binding used to pack the parameters required for calling // PackDeployString is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x6874e809. // the contract method with ID 0x6874e809. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function deployString() returns(string) // Solidity: function deployString() returns(string)
func (interactor *Interactor) PackDeployString() []byte { func (interactor *Interactor) PackDeployString() []byte {
@ -75,6 +76,15 @@ func (interactor *Interactor) PackDeployString() []byte {
return enc return enc
} }
// TryPackDeployString is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x6874e809. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function deployString() returns(string)
func (interactor *Interactor) TryPackDeployString() ([]byte, error) {
return interactor.abi.Pack("deployString")
}
// UnpackDeployString is the Go binding that unpacks the parameters returned // UnpackDeployString is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x6874e809. // from invoking the contract method with ID 0x6874e809.
// //
@ -85,11 +95,12 @@ func (interactor *Interactor) UnpackDeployString(data []byte) (string, error) {
return *new(string), err return *new(string), err
} }
out0 := *abi.ConvertType(out[0], new(string)).(*string) out0 := *abi.ConvertType(out[0], new(string)).(*string)
return out0, err return out0, nil
} }
// PackTransact is the Go binding used to pack the parameters required for calling // PackTransact is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd736c513. // the contract method with ID 0xd736c513. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function transact(string str) returns() // Solidity: function transact(string str) returns()
func (interactor *Interactor) PackTransact(str string) []byte { func (interactor *Interactor) PackTransact(str string) []byte {
@ -100,8 +111,18 @@ func (interactor *Interactor) PackTransact(str string) []byte {
return enc return enc
} }
// TryPackTransact is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd736c513. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function transact(string str) returns()
func (interactor *Interactor) TryPackTransact(str string) ([]byte, error) {
return interactor.abi.Pack("transact", str)
}
// PackTransactString is the Go binding used to pack the parameters required for calling // PackTransactString is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x0d86a0e1. // the contract method with ID 0x0d86a0e1. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function transactString() returns(string) // Solidity: function transactString() returns(string)
func (interactor *Interactor) PackTransactString() []byte { func (interactor *Interactor) PackTransactString() []byte {
@ -112,6 +133,15 @@ func (interactor *Interactor) PackTransactString() []byte {
return enc return enc
} }
// TryPackTransactString is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x0d86a0e1. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function transactString() returns(string)
func (interactor *Interactor) TryPackTransactString() ([]byte, error) {
return interactor.abi.Pack("transactString")
}
// UnpackTransactString is the Go binding that unpacks the parameters returned // UnpackTransactString is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x0d86a0e1. // from invoking the contract method with ID 0x0d86a0e1.
// //
@ -122,5 +152,5 @@ func (interactor *Interactor) UnpackTransactString(data []byte) (string, error)
return *new(string), err return *new(string), err
} }
out0 := *abi.ConvertType(out[0], new(string)).(*string) out0 := *abi.ConvertType(out[0], new(string)).(*string)
return out0, err return out0, nil
} }

View file

@ -58,7 +58,8 @@ func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Addres
} }
// PackAddRequest is the Go binding used to pack the parameters required for calling // PackAddRequest is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xcce7b048. // the contract method with ID 0xcce7b048. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function addRequest((bytes,bytes) req) pure returns() // Solidity: function addRequest((bytes,bytes) req) pure returns()
func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte { func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte {
@ -69,8 +70,18 @@ func (nameConflict *NameConflict) PackAddRequest(req Oraclerequest) []byte {
return enc return enc
} }
// TryPackAddRequest is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xcce7b048. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function addRequest((bytes,bytes) req) pure returns()
func (nameConflict *NameConflict) TryPackAddRequest(req Oraclerequest) ([]byte, error) {
return nameConflict.abi.Pack("addRequest", req)
}
// PackGetRequest is the Go binding used to pack the parameters required for calling // PackGetRequest is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xc2bb515f. // the contract method with ID 0xc2bb515f. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function getRequest() pure returns((bytes,bytes)) // Solidity: function getRequest() pure returns((bytes,bytes))
func (nameConflict *NameConflict) PackGetRequest() []byte { func (nameConflict *NameConflict) PackGetRequest() []byte {
@ -81,6 +92,15 @@ func (nameConflict *NameConflict) PackGetRequest() []byte {
return enc return enc
} }
// TryPackGetRequest is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xc2bb515f. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function getRequest() pure returns((bytes,bytes))
func (nameConflict *NameConflict) TryPackGetRequest() ([]byte, error) {
return nameConflict.abi.Pack("getRequest")
}
// UnpackGetRequest is the Go binding that unpacks the parameters returned // UnpackGetRequest is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xc2bb515f. // from invoking the contract method with ID 0xc2bb515f.
// //
@ -91,7 +111,7 @@ func (nameConflict *NameConflict) UnpackGetRequest(data []byte) (Oraclerequest,
return *new(Oraclerequest), err return *new(Oraclerequest), err
} }
out0 := *abi.ConvertType(out[0], new(Oraclerequest)).(*Oraclerequest) out0 := *abi.ConvertType(out[0], new(Oraclerequest)).(*Oraclerequest)
return out0, err return out0, nil
} }
// NameConflictLog represents a log event raised by the NameConflict contract. // NameConflictLog represents a log event raised by the NameConflict contract.

View file

@ -52,7 +52,8 @@ func (c *NumericMethodName) Instance(backend bind.ContractBackend, addr common.A
} }
// PackE1test is the Go binding used to pack the parameters required for calling // PackE1test is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xffa02795. // the contract method with ID 0xffa02795. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function _1test() pure returns() // Solidity: function _1test() pure returns()
func (numericMethodName *NumericMethodName) PackE1test() []byte { func (numericMethodName *NumericMethodName) PackE1test() []byte {
@ -63,8 +64,18 @@ func (numericMethodName *NumericMethodName) PackE1test() []byte {
return enc return enc
} }
// TryPackE1test is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xffa02795. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function _1test() pure returns()
func (numericMethodName *NumericMethodName) TryPackE1test() ([]byte, error) {
return numericMethodName.abi.Pack("_1test")
}
// PackE1test0 is the Go binding used to pack the parameters required for calling // PackE1test0 is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd02767c7. // the contract method with ID 0xd02767c7. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function __1test() pure returns() // Solidity: function __1test() pure returns()
func (numericMethodName *NumericMethodName) PackE1test0() []byte { func (numericMethodName *NumericMethodName) PackE1test0() []byte {
@ -75,8 +86,18 @@ func (numericMethodName *NumericMethodName) PackE1test0() []byte {
return enc return enc
} }
// TryPackE1test0 is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd02767c7. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function __1test() pure returns()
func (numericMethodName *NumericMethodName) TryPackE1test0() ([]byte, error) {
return numericMethodName.abi.Pack("__1test")
}
// PackE2test is the Go binding used to pack the parameters required for calling // PackE2test is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x9d993132. // the contract method with ID 0x9d993132. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function __2test() pure returns() // Solidity: function __2test() pure returns()
func (numericMethodName *NumericMethodName) PackE2test() []byte { func (numericMethodName *NumericMethodName) PackE2test() []byte {
@ -87,6 +108,15 @@ func (numericMethodName *NumericMethodName) PackE2test() []byte {
return enc return enc
} }
// TryPackE2test is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x9d993132. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function __2test() pure returns()
func (numericMethodName *NumericMethodName) TryPackE2test() ([]byte, error) {
return numericMethodName.abi.Pack("__2test")
}
// NumericMethodNameE1TestEvent represents a _1TestEvent event raised by the NumericMethodName contract. // NumericMethodNameE1TestEvent represents a _1TestEvent event raised by the NumericMethodName contract.
type NumericMethodNameE1TestEvent struct { type NumericMethodNameE1TestEvent struct {
Param common.Address Param common.Address

View file

@ -51,7 +51,8 @@ func (c *OutputChecker) Instance(backend bind.ContractBackend, addr common.Addre
} }
// PackAnonOutput is the Go binding used to pack the parameters required for calling // PackAnonOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x008bda05. // the contract method with ID 0x008bda05. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function anonOutput() returns(string) // Solidity: function anonOutput() returns(string)
func (outputChecker *OutputChecker) PackAnonOutput() []byte { func (outputChecker *OutputChecker) PackAnonOutput() []byte {
@ -62,6 +63,15 @@ func (outputChecker *OutputChecker) PackAnonOutput() []byte {
return enc return enc
} }
// TryPackAnonOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x008bda05. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function anonOutput() returns(string)
func (outputChecker *OutputChecker) TryPackAnonOutput() ([]byte, error) {
return outputChecker.abi.Pack("anonOutput")
}
// UnpackAnonOutput is the Go binding that unpacks the parameters returned // UnpackAnonOutput is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x008bda05. // from invoking the contract method with ID 0x008bda05.
// //
@ -72,11 +82,12 @@ func (outputChecker *OutputChecker) UnpackAnonOutput(data []byte) (string, error
return *new(string), err return *new(string), err
} }
out0 := *abi.ConvertType(out[0], new(string)).(*string) out0 := *abi.ConvertType(out[0], new(string)).(*string)
return out0, err return out0, nil
} }
// PackAnonOutputs is the Go binding used to pack the parameters required for calling // PackAnonOutputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x3c401115. // the contract method with ID 0x3c401115. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function anonOutputs() returns(string, string) // Solidity: function anonOutputs() returns(string, string)
func (outputChecker *OutputChecker) PackAnonOutputs() []byte { func (outputChecker *OutputChecker) PackAnonOutputs() []byte {
@ -87,6 +98,15 @@ func (outputChecker *OutputChecker) PackAnonOutputs() []byte {
return enc return enc
} }
// TryPackAnonOutputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x3c401115. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function anonOutputs() returns(string, string)
func (outputChecker *OutputChecker) TryPackAnonOutputs() ([]byte, error) {
return outputChecker.abi.Pack("anonOutputs")
}
// AnonOutputsOutput serves as a container for the return parameters of contract // AnonOutputsOutput serves as a container for the return parameters of contract
// method AnonOutputs. // method AnonOutputs.
type AnonOutputsOutput struct { type AnonOutputsOutput struct {
@ -106,12 +126,12 @@ func (outputChecker *OutputChecker) UnpackAnonOutputs(data []byte) (AnonOutputsO
} }
outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string)
outstruct.Arg1 = *abi.ConvertType(out[1], new(string)).(*string) outstruct.Arg1 = *abi.ConvertType(out[1], new(string)).(*string)
return *outstruct, err return *outstruct, nil
} }
// PackCollidingOutputs is the Go binding used to pack the parameters required for calling // PackCollidingOutputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xeccbc1ee. // the contract method with ID 0xeccbc1ee. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function collidingOutputs() returns(string str, string Str) // Solidity: function collidingOutputs() returns(string str, string Str)
func (outputChecker *OutputChecker) PackCollidingOutputs() []byte { func (outputChecker *OutputChecker) PackCollidingOutputs() []byte {
@ -122,6 +142,15 @@ func (outputChecker *OutputChecker) PackCollidingOutputs() []byte {
return enc return enc
} }
// TryPackCollidingOutputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xeccbc1ee. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function collidingOutputs() returns(string str, string Str)
func (outputChecker *OutputChecker) TryPackCollidingOutputs() ([]byte, error) {
return outputChecker.abi.Pack("collidingOutputs")
}
// CollidingOutputsOutput serves as a container for the return parameters of contract // CollidingOutputsOutput serves as a container for the return parameters of contract
// method CollidingOutputs. // method CollidingOutputs.
type CollidingOutputsOutput struct { type CollidingOutputsOutput struct {
@ -141,12 +170,12 @@ func (outputChecker *OutputChecker) UnpackCollidingOutputs(data []byte) (Collidi
} }
outstruct.Str = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str = *abi.ConvertType(out[0], new(string)).(*string)
outstruct.Str0 = *abi.ConvertType(out[1], new(string)).(*string) outstruct.Str0 = *abi.ConvertType(out[1], new(string)).(*string)
return *outstruct, err return *outstruct, nil
} }
// PackMixedOutputs is the Go binding used to pack the parameters required for calling // PackMixedOutputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x21b77b44. // the contract method with ID 0x21b77b44. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function mixedOutputs() returns(string, string str) // Solidity: function mixedOutputs() returns(string, string str)
func (outputChecker *OutputChecker) PackMixedOutputs() []byte { func (outputChecker *OutputChecker) PackMixedOutputs() []byte {
@ -157,6 +186,15 @@ func (outputChecker *OutputChecker) PackMixedOutputs() []byte {
return enc return enc
} }
// TryPackMixedOutputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x21b77b44. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function mixedOutputs() returns(string, string str)
func (outputChecker *OutputChecker) TryPackMixedOutputs() ([]byte, error) {
return outputChecker.abi.Pack("mixedOutputs")
}
// MixedOutputsOutput serves as a container for the return parameters of contract // MixedOutputsOutput serves as a container for the return parameters of contract
// method MixedOutputs. // method MixedOutputs.
type MixedOutputsOutput struct { type MixedOutputsOutput struct {
@ -176,12 +214,12 @@ func (outputChecker *OutputChecker) UnpackMixedOutputs(data []byte) (MixedOutput
} }
outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Arg0 = *abi.ConvertType(out[0], new(string)).(*string)
outstruct.Str = *abi.ConvertType(out[1], new(string)).(*string) outstruct.Str = *abi.ConvertType(out[1], new(string)).(*string)
return *outstruct, err return *outstruct, nil
} }
// PackNamedOutput is the Go binding used to pack the parameters required for calling // PackNamedOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x5e632bd5. // the contract method with ID 0x5e632bd5. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function namedOutput() returns(string str) // Solidity: function namedOutput() returns(string str)
func (outputChecker *OutputChecker) PackNamedOutput() []byte { func (outputChecker *OutputChecker) PackNamedOutput() []byte {
@ -192,6 +230,15 @@ func (outputChecker *OutputChecker) PackNamedOutput() []byte {
return enc return enc
} }
// TryPackNamedOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x5e632bd5. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function namedOutput() returns(string str)
func (outputChecker *OutputChecker) TryPackNamedOutput() ([]byte, error) {
return outputChecker.abi.Pack("namedOutput")
}
// UnpackNamedOutput is the Go binding that unpacks the parameters returned // UnpackNamedOutput is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x5e632bd5. // from invoking the contract method with ID 0x5e632bd5.
// //
@ -202,11 +249,12 @@ func (outputChecker *OutputChecker) UnpackNamedOutput(data []byte) (string, erro
return *new(string), err return *new(string), err
} }
out0 := *abi.ConvertType(out[0], new(string)).(*string) out0 := *abi.ConvertType(out[0], new(string)).(*string)
return out0, err return out0, nil
} }
// PackNamedOutputs is the Go binding used to pack the parameters required for calling // PackNamedOutputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x7970a189. // the contract method with ID 0x7970a189. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function namedOutputs() returns(string str1, string str2) // Solidity: function namedOutputs() returns(string str1, string str2)
func (outputChecker *OutputChecker) PackNamedOutputs() []byte { func (outputChecker *OutputChecker) PackNamedOutputs() []byte {
@ -217,6 +265,15 @@ func (outputChecker *OutputChecker) PackNamedOutputs() []byte {
return enc return enc
} }
// TryPackNamedOutputs is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x7970a189. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function namedOutputs() returns(string str1, string str2)
func (outputChecker *OutputChecker) TryPackNamedOutputs() ([]byte, error) {
return outputChecker.abi.Pack("namedOutputs")
}
// NamedOutputsOutput serves as a container for the return parameters of contract // NamedOutputsOutput serves as a container for the return parameters of contract
// method NamedOutputs. // method NamedOutputs.
type NamedOutputsOutput struct { type NamedOutputsOutput struct {
@ -236,12 +293,12 @@ func (outputChecker *OutputChecker) UnpackNamedOutputs(data []byte) (NamedOutput
} }
outstruct.Str1 = *abi.ConvertType(out[0], new(string)).(*string) outstruct.Str1 = *abi.ConvertType(out[0], new(string)).(*string)
outstruct.Str2 = *abi.ConvertType(out[1], new(string)).(*string) outstruct.Str2 = *abi.ConvertType(out[1], new(string)).(*string)
return *outstruct, err return *outstruct, nil
} }
// PackNoOutput is the Go binding used to pack the parameters required for calling // PackNoOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x625f0306. // the contract method with ID 0x625f0306. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function noOutput() returns() // Solidity: function noOutput() returns()
func (outputChecker *OutputChecker) PackNoOutput() []byte { func (outputChecker *OutputChecker) PackNoOutput() []byte {
@ -251,3 +308,12 @@ func (outputChecker *OutputChecker) PackNoOutput() []byte {
} }
return enc return enc
} }
// TryPackNoOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x625f0306. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function noOutput() returns()
func (outputChecker *OutputChecker) TryPackNoOutput() ([]byte, error) {
return outputChecker.abi.Pack("noOutput")
}

View file

@ -52,7 +52,8 @@ func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) *
} }
// PackFoo is the Go binding used to pack the parameters required for calling // PackFoo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x04bc52f8. // the contract method with ID 0x04bc52f8. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function foo(uint256 i, uint256 j) returns() // Solidity: function foo(uint256 i, uint256 j) returns()
func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte { func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte {
@ -63,8 +64,18 @@ func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte {
return enc return enc
} }
// TryPackFoo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x04bc52f8. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function foo(uint256 i, uint256 j) returns()
func (overload *Overload) TryPackFoo(i *big.Int, j *big.Int) ([]byte, error) {
return overload.abi.Pack("foo", i, j)
}
// PackFoo0 is the Go binding used to pack the parameters required for calling // PackFoo0 is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2fbebd38. // the contract method with ID 0x2fbebd38. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function foo(uint256 i) returns() // Solidity: function foo(uint256 i) returns()
func (overload *Overload) PackFoo0(i *big.Int) []byte { func (overload *Overload) PackFoo0(i *big.Int) []byte {
@ -75,6 +86,15 @@ func (overload *Overload) PackFoo0(i *big.Int) []byte {
return enc return enc
} }
// TryPackFoo0 is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2fbebd38. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function foo(uint256 i) returns()
func (overload *Overload) TryPackFoo0(i *big.Int) ([]byte, error) {
return overload.abi.Pack("foo0", i)
}
// OverloadBar represents a bar event raised by the Overload contract. // OverloadBar represents a bar event raised by the Overload contract.
type OverloadBar struct { type OverloadBar struct {
I *big.Int I *big.Int

View file

@ -52,7 +52,8 @@ func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Addres
} }
// PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling // PackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x527a119f. // the contract method with ID 0x527a119f. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function functionWithKeywordParameter(uint256 range) pure returns() // Solidity: function functionWithKeywordParameter(uint256 range) pure returns()
func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int) []byte { func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int) []byte {
@ -62,3 +63,12 @@ func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int
} }
return enc return enc
} }
// TryPackFunctionWithKeywordParameter is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x527a119f. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function functionWithKeywordParameter(uint256 range) pure returns()
func (rangeKeyword *RangeKeyword) TryPackFunctionWithKeywordParameter(arg0 *big.Int) ([]byte, error) {
return rangeKeyword.abi.Pack("functionWithKeywordParameter", arg0)
}

View file

@ -52,7 +52,8 @@ func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) *bi
} }
// PackEchoAddresses is the Go binding used to pack the parameters required for calling // PackEchoAddresses is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xbe1127a3. // the contract method with ID 0xbe1127a3. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function echoAddresses(address[] input) returns(address[] output) // Solidity: function echoAddresses(address[] input) returns(address[] output)
func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte { func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte {
@ -63,6 +64,15 @@ func (slicer *Slicer) PackEchoAddresses(input []common.Address) []byte {
return enc return enc
} }
// TryPackEchoAddresses is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xbe1127a3. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function echoAddresses(address[] input) returns(address[] output)
func (slicer *Slicer) TryPackEchoAddresses(input []common.Address) ([]byte, error) {
return slicer.abi.Pack("echoAddresses", input)
}
// UnpackEchoAddresses is the Go binding that unpacks the parameters returned // UnpackEchoAddresses is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xbe1127a3. // from invoking the contract method with ID 0xbe1127a3.
// //
@ -73,11 +83,12 @@ func (slicer *Slicer) UnpackEchoAddresses(data []byte) ([]common.Address, error)
return *new([]common.Address), err return *new([]common.Address), err
} }
out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address)
return out0, err return out0, nil
} }
// PackEchoBools is the Go binding used to pack the parameters required for calling // PackEchoBools is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xf637e589. // the contract method with ID 0xf637e589. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function echoBools(bool[] input) returns(bool[] output) // Solidity: function echoBools(bool[] input) returns(bool[] output)
func (slicer *Slicer) PackEchoBools(input []bool) []byte { func (slicer *Slicer) PackEchoBools(input []bool) []byte {
@ -88,6 +99,15 @@ func (slicer *Slicer) PackEchoBools(input []bool) []byte {
return enc return enc
} }
// TryPackEchoBools is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xf637e589. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function echoBools(bool[] input) returns(bool[] output)
func (slicer *Slicer) TryPackEchoBools(input []bool) ([]byte, error) {
return slicer.abi.Pack("echoBools", input)
}
// UnpackEchoBools is the Go binding that unpacks the parameters returned // UnpackEchoBools is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xf637e589. // from invoking the contract method with ID 0xf637e589.
// //
@ -98,11 +118,12 @@ func (slicer *Slicer) UnpackEchoBools(data []byte) ([]bool, error) {
return *new([]bool), err return *new([]bool), err
} }
out0 := *abi.ConvertType(out[0], new([]bool)).(*[]bool) out0 := *abi.ConvertType(out[0], new([]bool)).(*[]bool)
return out0, err return out0, nil
} }
// PackEchoFancyInts is the Go binding used to pack the parameters required for calling // PackEchoFancyInts is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd88becc0. // the contract method with ID 0xd88becc0. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) // Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output)
func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte { func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte {
@ -113,6 +134,15 @@ func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte {
return enc return enc
} }
// TryPackEchoFancyInts is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd88becc0. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output)
func (slicer *Slicer) TryPackEchoFancyInts(input [23]*big.Int) ([]byte, error) {
return slicer.abi.Pack("echoFancyInts", input)
}
// UnpackEchoFancyInts is the Go binding that unpacks the parameters returned // UnpackEchoFancyInts is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xd88becc0. // from invoking the contract method with ID 0xd88becc0.
// //
@ -123,11 +153,12 @@ func (slicer *Slicer) UnpackEchoFancyInts(data []byte) ([23]*big.Int, error) {
return *new([23]*big.Int), err return *new([23]*big.Int), err
} }
out0 := *abi.ConvertType(out[0], new([23]*big.Int)).(*[23]*big.Int) out0 := *abi.ConvertType(out[0], new([23]*big.Int)).(*[23]*big.Int)
return out0, err return out0, nil
} }
// PackEchoInts is the Go binding used to pack the parameters required for calling // PackEchoInts is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe15a3db7. // the contract method with ID 0xe15a3db7. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function echoInts(int256[] input) returns(int256[] output) // Solidity: function echoInts(int256[] input) returns(int256[] output)
func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte { func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte {
@ -138,6 +169,15 @@ func (slicer *Slicer) PackEchoInts(input []*big.Int) []byte {
return enc return enc
} }
// TryPackEchoInts is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe15a3db7. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function echoInts(int256[] input) returns(int256[] output)
func (slicer *Slicer) TryPackEchoInts(input []*big.Int) ([]byte, error) {
return slicer.abi.Pack("echoInts", input)
}
// UnpackEchoInts is the Go binding that unpacks the parameters returned // UnpackEchoInts is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xe15a3db7. // from invoking the contract method with ID 0xe15a3db7.
// //
@ -148,5 +188,5 @@ func (slicer *Slicer) UnpackEchoInts(data []byte) ([]*big.Int, error) {
return *new([]*big.Int), err return *new([]*big.Int), err
} }
out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) out0 := *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int)
return out0, err return out0, nil
} }

View file

@ -57,7 +57,8 @@ func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) *b
} }
// PackF is the Go binding used to pack the parameters required for calling // PackF is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x28811f59. // the contract method with ID 0x28811f59. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d) // Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d)
func (structs *Structs) PackF() []byte { func (structs *Structs) PackF() []byte {
@ -68,6 +69,15 @@ func (structs *Structs) PackF() []byte {
return enc return enc
} }
// TryPackF is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x28811f59. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function F() view returns((bytes32)[] a, uint256[] c, bool[] d)
func (structs *Structs) TryPackF() ([]byte, error) {
return structs.abi.Pack("F")
}
// FOutput serves as a container for the return parameters of contract // FOutput serves as a container for the return parameters of contract
// method F. // method F.
type FOutput struct { type FOutput struct {
@ -89,12 +99,12 @@ func (structs *Structs) UnpackF(data []byte) (FOutput, error) {
outstruct.A = *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0) outstruct.A = *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0)
outstruct.C = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int) outstruct.C = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int)
outstruct.D = *abi.ConvertType(out[2], new([]bool)).(*[]bool) outstruct.D = *abi.ConvertType(out[2], new([]bool)).(*[]bool)
return *outstruct, err return *outstruct, nil
} }
// PackG is the Go binding used to pack the parameters required for calling // PackG is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x6fecb623. // the contract method with ID 0x6fecb623. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function G() view returns((bytes32)[] a) // Solidity: function G() view returns((bytes32)[] a)
func (structs *Structs) PackG() []byte { func (structs *Structs) PackG() []byte {
@ -105,6 +115,15 @@ func (structs *Structs) PackG() []byte {
return enc return enc
} }
// TryPackG is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x6fecb623. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function G() view returns((bytes32)[] a)
func (structs *Structs) TryPackG() ([]byte, error) {
return structs.abi.Pack("G")
}
// UnpackG is the Go binding that unpacks the parameters returned // UnpackG is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x6fecb623. // from invoking the contract method with ID 0x6fecb623.
// //
@ -115,5 +134,5 @@ func (structs *Structs) UnpackG(data []byte) ([]Struct0, error) {
return *new([]Struct0), err return *new([]Struct0), err
} }
out0 := *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0) out0 := *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0)
return out0, err return out0, nil
} }

View file

@ -64,7 +64,8 @@ func (token *Token) PackConstructor(initialSupply *big.Int, tokenName string, de
} }
// PackAllowance is the Go binding used to pack the parameters required for calling // PackAllowance is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xdd62ed3e. // the contract method with ID 0xdd62ed3e. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function allowance(address , address ) returns(uint256) // Solidity: function allowance(address , address ) returns(uint256)
func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []byte { func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []byte {
@ -75,6 +76,15 @@ func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []by
return enc return enc
} }
// TryPackAllowance is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xdd62ed3e. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function allowance(address , address ) returns(uint256)
func (token *Token) TryPackAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) {
return token.abi.Pack("allowance", arg0, arg1)
}
// UnpackAllowance is the Go binding that unpacks the parameters returned // UnpackAllowance is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xdd62ed3e. // from invoking the contract method with ID 0xdd62ed3e.
// //
@ -85,11 +95,12 @@ func (token *Token) UnpackAllowance(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackApproveAndCall is the Go binding used to pack the parameters required for calling // PackApproveAndCall is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xcae9ca51. // the contract method with ID 0xcae9ca51. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success) // Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success)
func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) []byte { func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) []byte {
@ -100,6 +111,15 @@ func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, e
return enc return enc
} }
// TryPackApproveAndCall is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xcae9ca51. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success)
func (token *Token) TryPackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) ([]byte, error) {
return token.abi.Pack("approveAndCall", spender, value, extraData)
}
// UnpackApproveAndCall is the Go binding that unpacks the parameters returned // UnpackApproveAndCall is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xcae9ca51. // from invoking the contract method with ID 0xcae9ca51.
// //
@ -110,11 +130,12 @@ func (token *Token) UnpackApproveAndCall(data []byte) (bool, error) {
return *new(bool), err return *new(bool), err
} }
out0 := *abi.ConvertType(out[0], new(bool)).(*bool) out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
return out0, err return out0, nil
} }
// PackBalanceOf is the Go binding used to pack the parameters required for calling // PackBalanceOf is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x70a08231. // the contract method with ID 0x70a08231. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function balanceOf(address ) returns(uint256) // Solidity: function balanceOf(address ) returns(uint256)
func (token *Token) PackBalanceOf(arg0 common.Address) []byte { func (token *Token) PackBalanceOf(arg0 common.Address) []byte {
@ -125,6 +146,15 @@ func (token *Token) PackBalanceOf(arg0 common.Address) []byte {
return enc return enc
} }
// TryPackBalanceOf is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x70a08231. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function balanceOf(address ) returns(uint256)
func (token *Token) TryPackBalanceOf(arg0 common.Address) ([]byte, error) {
return token.abi.Pack("balanceOf", arg0)
}
// UnpackBalanceOf is the Go binding that unpacks the parameters returned // UnpackBalanceOf is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x70a08231. // from invoking the contract method with ID 0x70a08231.
// //
@ -135,11 +165,12 @@ func (token *Token) UnpackBalanceOf(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackDecimals is the Go binding used to pack the parameters required for calling // PackDecimals is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x313ce567. // the contract method with ID 0x313ce567. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function decimals() returns(uint8) // Solidity: function decimals() returns(uint8)
func (token *Token) PackDecimals() []byte { func (token *Token) PackDecimals() []byte {
@ -150,6 +181,15 @@ func (token *Token) PackDecimals() []byte {
return enc return enc
} }
// TryPackDecimals is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x313ce567. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function decimals() returns(uint8)
func (token *Token) TryPackDecimals() ([]byte, error) {
return token.abi.Pack("decimals")
}
// UnpackDecimals is the Go binding that unpacks the parameters returned // UnpackDecimals is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x313ce567. // from invoking the contract method with ID 0x313ce567.
// //
@ -160,11 +200,12 @@ func (token *Token) UnpackDecimals(data []byte) (uint8, error) {
return *new(uint8), err return *new(uint8), err
} }
out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8)
return out0, err return out0, nil
} }
// PackName is the Go binding used to pack the parameters required for calling // PackName is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x06fdde03. // the contract method with ID 0x06fdde03. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function name() returns(string) // Solidity: function name() returns(string)
func (token *Token) PackName() []byte { func (token *Token) PackName() []byte {
@ -175,6 +216,15 @@ func (token *Token) PackName() []byte {
return enc return enc
} }
// TryPackName is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x06fdde03. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function name() returns(string)
func (token *Token) TryPackName() ([]byte, error) {
return token.abi.Pack("name")
}
// UnpackName is the Go binding that unpacks the parameters returned // UnpackName is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x06fdde03. // from invoking the contract method with ID 0x06fdde03.
// //
@ -185,11 +235,12 @@ func (token *Token) UnpackName(data []byte) (string, error) {
return *new(string), err return *new(string), err
} }
out0 := *abi.ConvertType(out[0], new(string)).(*string) out0 := *abi.ConvertType(out[0], new(string)).(*string)
return out0, err return out0, nil
} }
// PackSpentAllowance is the Go binding used to pack the parameters required for calling // PackSpentAllowance is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xdc3080f2. // the contract method with ID 0xdc3080f2. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function spentAllowance(address , address ) returns(uint256) // Solidity: function spentAllowance(address , address ) returns(uint256)
func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) []byte { func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address) []byte {
@ -200,6 +251,15 @@ func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address)
return enc return enc
} }
// TryPackSpentAllowance is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xdc3080f2. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function spentAllowance(address , address ) returns(uint256)
func (token *Token) TryPackSpentAllowance(arg0 common.Address, arg1 common.Address) ([]byte, error) {
return token.abi.Pack("spentAllowance", arg0, arg1)
}
// UnpackSpentAllowance is the Go binding that unpacks the parameters returned // UnpackSpentAllowance is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xdc3080f2. // from invoking the contract method with ID 0xdc3080f2.
// //
@ -210,11 +270,12 @@ func (token *Token) UnpackSpentAllowance(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackSymbol is the Go binding used to pack the parameters required for calling // PackSymbol is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x95d89b41. // the contract method with ID 0x95d89b41. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function symbol() returns(string) // Solidity: function symbol() returns(string)
func (token *Token) PackSymbol() []byte { func (token *Token) PackSymbol() []byte {
@ -225,6 +286,15 @@ func (token *Token) PackSymbol() []byte {
return enc return enc
} }
// TryPackSymbol is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x95d89b41. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function symbol() returns(string)
func (token *Token) TryPackSymbol() ([]byte, error) {
return token.abi.Pack("symbol")
}
// UnpackSymbol is the Go binding that unpacks the parameters returned // UnpackSymbol is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x95d89b41. // from invoking the contract method with ID 0x95d89b41.
// //
@ -235,11 +305,12 @@ func (token *Token) UnpackSymbol(data []byte) (string, error) {
return *new(string), err return *new(string), err
} }
out0 := *abi.ConvertType(out[0], new(string)).(*string) out0 := *abi.ConvertType(out[0], new(string)).(*string)
return out0, err return out0, nil
} }
// PackTransfer is the Go binding used to pack the parameters required for calling // PackTransfer is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xa9059cbb. // the contract method with ID 0xa9059cbb. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function transfer(address _to, uint256 _value) returns() // Solidity: function transfer(address _to, uint256 _value) returns()
func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte { func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte {
@ -250,8 +321,18 @@ func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte {
return enc return enc
} }
// TryPackTransfer is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xa9059cbb. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function transfer(address _to, uint256 _value) returns()
func (token *Token) TryPackTransfer(to common.Address, value *big.Int) ([]byte, error) {
return token.abi.Pack("transfer", to, value)
}
// PackTransferFrom is the Go binding used to pack the parameters required for calling // PackTransferFrom is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x23b872dd. // the contract method with ID 0x23b872dd. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) // Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success)
func (token *Token) PackTransferFrom(from common.Address, to common.Address, value *big.Int) []byte { func (token *Token) PackTransferFrom(from common.Address, to common.Address, value *big.Int) []byte {
@ -262,6 +343,15 @@ func (token *Token) PackTransferFrom(from common.Address, to common.Address, val
return enc return enc
} }
// TryPackTransferFrom is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x23b872dd. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success)
func (token *Token) TryPackTransferFrom(from common.Address, to common.Address, value *big.Int) ([]byte, error) {
return token.abi.Pack("transferFrom", from, to, value)
}
// UnpackTransferFrom is the Go binding that unpacks the parameters returned // UnpackTransferFrom is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x23b872dd. // from invoking the contract method with ID 0x23b872dd.
// //
@ -272,7 +362,7 @@ func (token *Token) UnpackTransferFrom(data []byte) (bool, error) {
return *new(bool), err return *new(bool), err
} }
out0 := *abi.ConvertType(out[0], new(bool)).(*bool) out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
return out0, err return out0, nil
} }
// TokenTransfer represents a Transfer event raised by the Token contract. // TokenTransfer represents a Transfer event raised by the Token contract.

View file

@ -77,7 +77,8 @@ func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bin
} }
// PackFunc1 is the Go binding used to pack the parameters required for calling // PackFunc1 is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x443c79b4. // the contract method with ID 0x443c79b4. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) // Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[])
func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte { func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte {
@ -88,6 +89,15 @@ func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS
return enc return enc
} }
// TryPackFunc1 is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x443c79b4. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[])
func (tuple *Tuple) TryPackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) {
return tuple.abi.Pack("func1", a, b, c, d, e)
}
// Func1Output serves as a container for the return parameters of contract // Func1Output serves as a container for the return parameters of contract
// method Func1. // method Func1.
type Func1Output struct { type Func1Output struct {
@ -113,12 +123,12 @@ func (tuple *Tuple) UnpackFunc1(data []byte) (Func1Output, error) {
outstruct.Arg2 = *abi.ConvertType(out[2], new([2][]TupleT)).(*[2][]TupleT) outstruct.Arg2 = *abi.ConvertType(out[2], new([2][]TupleT)).(*[2][]TupleT)
outstruct.Arg3 = *abi.ConvertType(out[3], new([]TupleS)).(*[]TupleS) outstruct.Arg3 = *abi.ConvertType(out[3], new([]TupleS)).(*[]TupleS)
outstruct.Arg4 = *abi.ConvertType(out[4], new([]*big.Int)).(*[]*big.Int) outstruct.Arg4 = *abi.ConvertType(out[4], new([]*big.Int)).(*[]*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackFunc2 is the Go binding used to pack the parameters required for calling // PackFunc2 is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd0062cdd. // the contract method with ID 0xd0062cdd. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns() // Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns()
func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte { func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte {
@ -129,8 +139,18 @@ func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS
return enc return enc
} }
// TryPackFunc2 is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xd0062cdd. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns()
func (tuple *Tuple) TryPackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) ([]byte, error) {
return tuple.abi.Pack("func2", a, b, c, d, e)
}
// PackFunc3 is the Go binding used to pack the parameters required for calling // PackFunc3 is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe4d9a43b. // the contract method with ID 0xe4d9a43b. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function func3((uint16,uint16)[] ) pure returns() // Solidity: function func3((uint16,uint16)[] ) pure returns()
func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte { func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte {
@ -141,6 +161,15 @@ func (tuple *Tuple) PackFunc3(arg0 []TupleQ) []byte {
return enc return enc
} }
// TryPackFunc3 is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe4d9a43b. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function func3((uint16,uint16)[] ) pure returns()
func (tuple *Tuple) TryPackFunc3(arg0 []TupleQ) ([]byte, error) {
return tuple.abi.Pack("func3", arg0)
}
// TupleTupleEvent represents a TupleEvent event raised by the Tuple contract. // TupleTupleEvent represents a TupleEvent event raised by the Tuple contract.
type TupleTupleEvent struct { type TupleTupleEvent struct {
A TupleS A TupleS

View file

@ -52,7 +52,8 @@ func (c *Tupler) Instance(backend bind.ContractBackend, addr common.Address) *bi
} }
// PackTuple is the Go binding used to pack the parameters required for calling // PackTuple is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x3175aae2. // the contract method with ID 0x3175aae2. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function tuple() returns(string a, int256 b, bytes32 c) // Solidity: function tuple() returns(string a, int256 b, bytes32 c)
func (tupler *Tupler) PackTuple() []byte { func (tupler *Tupler) PackTuple() []byte {
@ -63,6 +64,15 @@ func (tupler *Tupler) PackTuple() []byte {
return enc return enc
} }
// TryPackTuple is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x3175aae2. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function tuple() returns(string a, int256 b, bytes32 c)
func (tupler *Tupler) TryPackTuple() ([]byte, error) {
return tupler.abi.Pack("tuple")
}
// TupleOutput serves as a container for the return parameters of contract // TupleOutput serves as a container for the return parameters of contract
// method Tuple. // method Tuple.
type TupleOutput struct { type TupleOutput struct {
@ -84,6 +94,5 @@ func (tupler *Tupler) UnpackTuple(data []byte) (TupleOutput, error) {
outstruct.A = *abi.ConvertType(out[0], new(string)).(*string) outstruct.A = *abi.ConvertType(out[0], new(string)).(*string)
outstruct.B = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.B = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
outstruct.C = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte) outstruct.C = *abi.ConvertType(out[2], new([32]byte)).(*[32]byte)
return *outstruct, err return *outstruct, nil
} }

View file

@ -52,7 +52,8 @@ func (c *Underscorer) Instance(backend bind.ContractBackend, addr common.Address
} }
// PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling // PackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xb564b34d. // the contract method with ID 0xb564b34d. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __) // Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __)
func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte { func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte {
@ -63,6 +64,15 @@ func (underscorer *Underscorer) PackAllPurelyUnderscoredOutput() []byte {
return enc return enc
} }
// TryPackAllPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xb564b34d. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function AllPurelyUnderscoredOutput() view returns(int256 _, int256 __)
func (underscorer *Underscorer) TryPackAllPurelyUnderscoredOutput() ([]byte, error) {
return underscorer.abi.Pack("AllPurelyUnderscoredOutput")
}
// AllPurelyUnderscoredOutputOutput serves as a container for the return parameters of contract // AllPurelyUnderscoredOutputOutput serves as a container for the return parameters of contract
// method AllPurelyUnderscoredOutput. // method AllPurelyUnderscoredOutput.
type AllPurelyUnderscoredOutputOutput struct { type AllPurelyUnderscoredOutputOutput struct {
@ -82,12 +92,12 @@ func (underscorer *Underscorer) UnpackAllPurelyUnderscoredOutput(data []byte) (A
} }
outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackLowerLowerCollision is the Go binding used to pack the parameters required for calling // PackLowerLowerCollision is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe409ca45. // the contract method with ID 0xe409ca45. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res) // Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res)
func (underscorer *Underscorer) PackLowerLowerCollision() []byte { func (underscorer *Underscorer) PackLowerLowerCollision() []byte {
@ -98,6 +108,15 @@ func (underscorer *Underscorer) PackLowerLowerCollision() []byte {
return enc return enc
} }
// TryPackLowerLowerCollision is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe409ca45. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function LowerLowerCollision() view returns(int256 _res, int256 res)
func (underscorer *Underscorer) TryPackLowerLowerCollision() ([]byte, error) {
return underscorer.abi.Pack("LowerLowerCollision")
}
// LowerLowerCollisionOutput serves as a container for the return parameters of contract // LowerLowerCollisionOutput serves as a container for the return parameters of contract
// method LowerLowerCollision. // method LowerLowerCollision.
type LowerLowerCollisionOutput struct { type LowerLowerCollisionOutput struct {
@ -117,12 +136,12 @@ func (underscorer *Underscorer) UnpackLowerLowerCollision(data []byte) (LowerLow
} }
outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackLowerUpperCollision is the Go binding used to pack the parameters required for calling // PackLowerUpperCollision is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x03a59213. // the contract method with ID 0x03a59213. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res) // Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res)
func (underscorer *Underscorer) PackLowerUpperCollision() []byte { func (underscorer *Underscorer) PackLowerUpperCollision() []byte {
@ -133,6 +152,15 @@ func (underscorer *Underscorer) PackLowerUpperCollision() []byte {
return enc return enc
} }
// TryPackLowerUpperCollision is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x03a59213. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function LowerUpperCollision() view returns(int256 _res, int256 Res)
func (underscorer *Underscorer) TryPackLowerUpperCollision() ([]byte, error) {
return underscorer.abi.Pack("LowerUpperCollision")
}
// LowerUpperCollisionOutput serves as a container for the return parameters of contract // LowerUpperCollisionOutput serves as a container for the return parameters of contract
// method LowerUpperCollision. // method LowerUpperCollision.
type LowerUpperCollisionOutput struct { type LowerUpperCollisionOutput struct {
@ -152,12 +180,12 @@ func (underscorer *Underscorer) UnpackLowerUpperCollision(data []byte) (LowerUpp
} }
outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling // PackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x9df48485. // the contract method with ID 0x9df48485. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res) // Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res)
func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte { func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte {
@ -168,6 +196,15 @@ func (underscorer *Underscorer) PackPurelyUnderscoredOutput() []byte {
return enc return enc
} }
// TryPackPurelyUnderscoredOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x9df48485. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function PurelyUnderscoredOutput() view returns(int256 _, int256 res)
func (underscorer *Underscorer) TryPackPurelyUnderscoredOutput() ([]byte, error) {
return underscorer.abi.Pack("PurelyUnderscoredOutput")
}
// PurelyUnderscoredOutputOutput serves as a container for the return parameters of contract // PurelyUnderscoredOutputOutput serves as a container for the return parameters of contract
// method PurelyUnderscoredOutput. // method PurelyUnderscoredOutput.
type PurelyUnderscoredOutputOutput struct { type PurelyUnderscoredOutputOutput struct {
@ -187,12 +224,12 @@ func (underscorer *Underscorer) UnpackPurelyUnderscoredOutput(data []byte) (Pure
} }
outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
outstruct.Res = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Res = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackUnderscoredOutput is the Go binding used to pack the parameters required for calling // PackUnderscoredOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x67e6633d. // the contract method with ID 0x67e6633d. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function UnderscoredOutput() view returns(int256 _int, string _string) // Solidity: function UnderscoredOutput() view returns(int256 _int, string _string)
func (underscorer *Underscorer) PackUnderscoredOutput() []byte { func (underscorer *Underscorer) PackUnderscoredOutput() []byte {
@ -203,6 +240,15 @@ func (underscorer *Underscorer) PackUnderscoredOutput() []byte {
return enc return enc
} }
// TryPackUnderscoredOutput is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x67e6633d. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function UnderscoredOutput() view returns(int256 _int, string _string)
func (underscorer *Underscorer) TryPackUnderscoredOutput() ([]byte, error) {
return underscorer.abi.Pack("UnderscoredOutput")
}
// UnderscoredOutputOutput serves as a container for the return parameters of contract // UnderscoredOutputOutput serves as a container for the return parameters of contract
// method UnderscoredOutput. // method UnderscoredOutput.
type UnderscoredOutputOutput struct { type UnderscoredOutputOutput struct {
@ -222,12 +268,12 @@ func (underscorer *Underscorer) UnpackUnderscoredOutput(data []byte) (Underscore
} }
outstruct.Int = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Int = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
outstruct.String = *abi.ConvertType(out[1], new(string)).(*string) outstruct.String = *abi.ConvertType(out[1], new(string)).(*string)
return *outstruct, err return *outstruct, nil
} }
// PackUpperLowerCollision is the Go binding used to pack the parameters required for calling // PackUpperLowerCollision is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xaf7486ab. // the contract method with ID 0xaf7486ab. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res) // Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res)
func (underscorer *Underscorer) PackUpperLowerCollision() []byte { func (underscorer *Underscorer) PackUpperLowerCollision() []byte {
@ -238,6 +284,15 @@ func (underscorer *Underscorer) PackUpperLowerCollision() []byte {
return enc return enc
} }
// TryPackUpperLowerCollision is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xaf7486ab. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function UpperLowerCollision() view returns(int256 _Res, int256 res)
func (underscorer *Underscorer) TryPackUpperLowerCollision() ([]byte, error) {
return underscorer.abi.Pack("UpperLowerCollision")
}
// UpperLowerCollisionOutput serves as a container for the return parameters of contract // UpperLowerCollisionOutput serves as a container for the return parameters of contract
// method UpperLowerCollision. // method UpperLowerCollision.
type UpperLowerCollisionOutput struct { type UpperLowerCollisionOutput struct {
@ -257,12 +312,12 @@ func (underscorer *Underscorer) UnpackUpperLowerCollision(data []byte) (UpperLow
} }
outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackUpperUpperCollision is the Go binding used to pack the parameters required for calling // PackUpperUpperCollision is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe02ab24d. // the contract method with ID 0xe02ab24d. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res) // Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res)
func (underscorer *Underscorer) PackUpperUpperCollision() []byte { func (underscorer *Underscorer) PackUpperUpperCollision() []byte {
@ -273,6 +328,15 @@ func (underscorer *Underscorer) PackUpperUpperCollision() []byte {
return enc return enc
} }
// TryPackUpperUpperCollision is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe02ab24d. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function UpperUpperCollision() view returns(int256 _Res, int256 Res)
func (underscorer *Underscorer) TryPackUpperUpperCollision() ([]byte, error) {
return underscorer.abi.Pack("UpperUpperCollision")
}
// UpperUpperCollisionOutput serves as a container for the return parameters of contract // UpperUpperCollisionOutput serves as a container for the return parameters of contract
// method UpperUpperCollision. // method UpperUpperCollision.
type UpperUpperCollisionOutput struct { type UpperUpperCollisionOutput struct {
@ -292,12 +356,12 @@ func (underscorer *Underscorer) UnpackUpperUpperCollision(data []byte) (UpperUpp
} }
outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Res = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Res0 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackUnderScoredFunc is the Go binding used to pack the parameters required for calling // PackUnderScoredFunc is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x46546dbe. // the contract method with ID 0x46546dbe. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function _under_scored_func() view returns(int256 _int) // Solidity: function _under_scored_func() view returns(int256 _int)
func (underscorer *Underscorer) PackUnderScoredFunc() []byte { func (underscorer *Underscorer) PackUnderScoredFunc() []byte {
@ -308,6 +372,15 @@ func (underscorer *Underscorer) PackUnderScoredFunc() []byte {
return enc return enc
} }
// TryPackUnderScoredFunc is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x46546dbe. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function _under_scored_func() view returns(int256 _int)
func (underscorer *Underscorer) TryPackUnderScoredFunc() ([]byte, error) {
return underscorer.abi.Pack("_under_scored_func")
}
// UnpackUnderScoredFunc is the Go binding that unpacks the parameters returned // UnpackUnderScoredFunc is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x46546dbe. // from invoking the contract method with ID 0x46546dbe.
// //
@ -318,5 +391,5 @@ func (underscorer *Underscorer) UnpackUnderScoredFunc(data []byte) (*big.Int, er
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }

View file

@ -59,7 +59,8 @@ func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
} }
// PackGet is the Go binding used to pack the parameters required for calling // PackGet is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x9507d39a. // the contract method with ID 0x9507d39a. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function get(uint256 k) returns(uint256) // Solidity: function get(uint256 k) returns(uint256)
func (dB *DB) PackGet(k *big.Int) []byte { func (dB *DB) PackGet(k *big.Int) []byte {
@ -70,6 +71,15 @@ func (dB *DB) PackGet(k *big.Int) []byte {
return enc return enc
} }
// TryPackGet is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x9507d39a. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function get(uint256 k) returns(uint256)
func (dB *DB) TryPackGet(k *big.Int) ([]byte, error) {
return dB.abi.Pack("get", k)
}
// UnpackGet is the Go binding that unpacks the parameters returned // UnpackGet is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x9507d39a. // from invoking the contract method with ID 0x9507d39a.
// //
@ -80,11 +90,12 @@ func (dB *DB) UnpackGet(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// PackGetNamedStatParams is the Go binding used to pack the parameters required for calling // PackGetNamedStatParams is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe369ba3b. // the contract method with ID 0xe369ba3b. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods) // Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods)
func (dB *DB) PackGetNamedStatParams() []byte { func (dB *DB) PackGetNamedStatParams() []byte {
@ -95,6 +106,15 @@ func (dB *DB) PackGetNamedStatParams() []byte {
return enc return enc
} }
// TryPackGetNamedStatParams is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe369ba3b. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function getNamedStatParams() view returns(uint256 gets, uint256 inserts, uint256 mods)
func (dB *DB) TryPackGetNamedStatParams() ([]byte, error) {
return dB.abi.Pack("getNamedStatParams")
}
// GetNamedStatParamsOutput serves as a container for the return parameters of contract // GetNamedStatParamsOutput serves as a container for the return parameters of contract
// method GetNamedStatParams. // method GetNamedStatParams.
type GetNamedStatParamsOutput struct { type GetNamedStatParamsOutput struct {
@ -116,12 +136,12 @@ func (dB *DB) UnpackGetNamedStatParams(data []byte) (GetNamedStatParamsOutput, e
outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Gets = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Inserts = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
outstruct.Mods = abi.ConvertType(out[2], new(big.Int)).(*big.Int) outstruct.Mods = abi.ConvertType(out[2], new(big.Int)).(*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackGetStatParams is the Go binding used to pack the parameters required for calling // PackGetStatParams is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x6fcb9c70. // the contract method with ID 0x6fcb9c70. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function getStatParams() view returns(uint256, uint256, uint256) // Solidity: function getStatParams() view returns(uint256, uint256, uint256)
func (dB *DB) PackGetStatParams() []byte { func (dB *DB) PackGetStatParams() []byte {
@ -132,6 +152,15 @@ func (dB *DB) PackGetStatParams() []byte {
return enc return enc
} }
// TryPackGetStatParams is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x6fcb9c70. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function getStatParams() view returns(uint256, uint256, uint256)
func (dB *DB) TryPackGetStatParams() ([]byte, error) {
return dB.abi.Pack("getStatParams")
}
// GetStatParamsOutput serves as a container for the return parameters of contract // GetStatParamsOutput serves as a container for the return parameters of contract
// method GetStatParams. // method GetStatParams.
type GetStatParamsOutput struct { type GetStatParamsOutput struct {
@ -153,12 +182,12 @@ func (dB *DB) UnpackGetStatParams(data []byte) (GetStatParamsOutput, error) {
outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int) outstruct.Arg0 = abi.ConvertType(out[0], new(big.Int)).(*big.Int)
outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Arg1 = abi.ConvertType(out[1], new(big.Int)).(*big.Int)
outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(*big.Int) outstruct.Arg2 = abi.ConvertType(out[2], new(big.Int)).(*big.Int)
return *outstruct, err return *outstruct, nil
} }
// PackGetStatsStruct is the Go binding used to pack the parameters required for calling // PackGetStatsStruct is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xee8161e0. // the contract method with ID 0xee8161e0. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function getStatsStruct() view returns((uint256,uint256,uint256)) // Solidity: function getStatsStruct() view returns((uint256,uint256,uint256))
func (dB *DB) PackGetStatsStruct() []byte { func (dB *DB) PackGetStatsStruct() []byte {
@ -169,6 +198,15 @@ func (dB *DB) PackGetStatsStruct() []byte {
return enc return enc
} }
// TryPackGetStatsStruct is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xee8161e0. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function getStatsStruct() view returns((uint256,uint256,uint256))
func (dB *DB) TryPackGetStatsStruct() ([]byte, error) {
return dB.abi.Pack("getStatsStruct")
}
// UnpackGetStatsStruct is the Go binding that unpacks the parameters returned // UnpackGetStatsStruct is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xee8161e0. // from invoking the contract method with ID 0xee8161e0.
// //
@ -179,11 +217,12 @@ func (dB *DB) UnpackGetStatsStruct(data []byte) (DBStats, error) {
return *new(DBStats), err return *new(DBStats), err
} }
out0 := *abi.ConvertType(out[0], new(DBStats)).(*DBStats) out0 := *abi.ConvertType(out[0], new(DBStats)).(*DBStats)
return out0, err return out0, nil
} }
// PackInsert is the Go binding used to pack the parameters required for calling // PackInsert is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x1d834a1b. // the contract method with ID 0x1d834a1b. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function insert(uint256 k, uint256 v) returns(uint256) // Solidity: function insert(uint256 k, uint256 v) returns(uint256)
func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte { func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte {
@ -194,6 +233,15 @@ func (dB *DB) PackInsert(k *big.Int, v *big.Int) []byte {
return enc return enc
} }
// TryPackInsert is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x1d834a1b. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function insert(uint256 k, uint256 v) returns(uint256)
func (dB *DB) TryPackInsert(k *big.Int, v *big.Int) ([]byte, error) {
return dB.abi.Pack("insert", k, v)
}
// UnpackInsert is the Go binding that unpacks the parameters returned // UnpackInsert is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x1d834a1b. // from invoking the contract method with ID 0x1d834a1b.
// //
@ -204,7 +252,7 @@ func (dB *DB) UnpackInsert(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// DBInsert represents a Insert event raised by the DB contract. // DBInsert represents a Insert event raised by the DB contract.

View file

@ -52,7 +52,8 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo
} }
// PackEmitMulti is the Go binding used to pack the parameters required for calling // PackEmitMulti is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xcb493749. // the contract method with ID 0xcb493749. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function EmitMulti() returns() // Solidity: function EmitMulti() returns()
func (c *C) PackEmitMulti() []byte { func (c *C) PackEmitMulti() []byte {
@ -63,8 +64,18 @@ func (c *C) PackEmitMulti() []byte {
return enc return enc
} }
// TryPackEmitMulti is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xcb493749. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function EmitMulti() returns()
func (c *C) TryPackEmitMulti() ([]byte, error) {
return c.abi.Pack("EmitMulti")
}
// PackEmitOne is the Go binding used to pack the parameters required for calling // PackEmitOne is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe8e49a71. // the contract method with ID 0xe8e49a71. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function EmitOne() returns() // Solidity: function EmitOne() returns()
func (c *C) PackEmitOne() []byte { func (c *C) PackEmitOne() []byte {
@ -75,6 +86,15 @@ func (c *C) PackEmitOne() []byte {
return enc return enc
} }
// TryPackEmitOne is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xe8e49a71. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function EmitOne() returns()
func (c *C) TryPackEmitOne() ([]byte, error) {
return c.abi.Pack("EmitOne")
}
// CBasic1 represents a basic1 event raised by the C contract. // CBasic1 represents a basic1 event raised by the C contract.
type CBasic1 struct { type CBasic1 struct {
Id *big.Int Id *big.Int

View file

@ -68,7 +68,8 @@ func (c1 *C1) PackConstructor(v1 *big.Int, v2 *big.Int) []byte {
} }
// PackDo is the Go binding used to pack the parameters required for calling // PackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Do(uint256 val) pure returns(uint256 res) // Solidity: function Do(uint256 val) pure returns(uint256 res)
func (c1 *C1) PackDo(val *big.Int) []byte { func (c1 *C1) PackDo(val *big.Int) []byte {
@ -79,6 +80,15 @@ func (c1 *C1) PackDo(val *big.Int) []byte {
return enc return enc
} }
// TryPackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Do(uint256 val) pure returns(uint256 res)
func (c1 *C1) TryPackDo(val *big.Int) ([]byte, error) {
return c1.abi.Pack("Do", val)
}
// UnpackDo is the Go binding that unpacks the parameters returned // UnpackDo is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x2ad11272. // from invoking the contract method with ID 0x2ad11272.
// //
@ -89,7 +99,7 @@ func (c1 *C1) UnpackDo(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// C2MetaData contains all meta data concerning the C2 contract. // C2MetaData contains all meta data concerning the C2 contract.
@ -136,7 +146,8 @@ func (c2 *C2) PackConstructor(v1 *big.Int, v2 *big.Int) []byte {
} }
// PackDo is the Go binding used to pack the parameters required for calling // PackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Do(uint256 val) pure returns(uint256 res) // Solidity: function Do(uint256 val) pure returns(uint256 res)
func (c2 *C2) PackDo(val *big.Int) []byte { func (c2 *C2) PackDo(val *big.Int) []byte {
@ -147,6 +158,15 @@ func (c2 *C2) PackDo(val *big.Int) []byte {
return enc return enc
} }
// TryPackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Do(uint256 val) pure returns(uint256 res)
func (c2 *C2) TryPackDo(val *big.Int) ([]byte, error) {
return c2.abi.Pack("Do", val)
}
// UnpackDo is the Go binding that unpacks the parameters returned // UnpackDo is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x2ad11272. // from invoking the contract method with ID 0x2ad11272.
// //
@ -157,7 +177,7 @@ func (c2 *C2) UnpackDo(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// L1MetaData contains all meta data concerning the L1 contract. // L1MetaData contains all meta data concerning the L1 contract.
@ -188,7 +208,8 @@ func (c *L1) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
} }
// PackDo is the Go binding used to pack the parameters required for calling // PackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l1 *L1) PackDo(val *big.Int) []byte { func (l1 *L1) PackDo(val *big.Int) []byte {
@ -199,6 +220,15 @@ func (l1 *L1) PackDo(val *big.Int) []byte {
return enc return enc
} }
// TryPackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Do(uint256 val) pure returns(uint256)
func (l1 *L1) TryPackDo(val *big.Int) ([]byte, error) {
return l1.abi.Pack("Do", val)
}
// UnpackDo is the Go binding that unpacks the parameters returned // UnpackDo is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x2ad11272. // from invoking the contract method with ID 0x2ad11272.
// //
@ -209,7 +239,7 @@ func (l1 *L1) UnpackDo(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// L2MetaData contains all meta data concerning the L2 contract. // L2MetaData contains all meta data concerning the L2 contract.
@ -243,7 +273,8 @@ func (c *L2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
} }
// PackDo is the Go binding used to pack the parameters required for calling // PackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l2 *L2) PackDo(val *big.Int) []byte { func (l2 *L2) PackDo(val *big.Int) []byte {
@ -254,6 +285,15 @@ func (l2 *L2) PackDo(val *big.Int) []byte {
return enc return enc
} }
// TryPackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Do(uint256 val) pure returns(uint256)
func (l2 *L2) TryPackDo(val *big.Int) ([]byte, error) {
return l2.abi.Pack("Do", val)
}
// UnpackDo is the Go binding that unpacks the parameters returned // UnpackDo is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x2ad11272. // from invoking the contract method with ID 0x2ad11272.
// //
@ -264,7 +304,7 @@ func (l2 *L2) UnpackDo(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// L2bMetaData contains all meta data concerning the L2b contract. // L2bMetaData contains all meta data concerning the L2b contract.
@ -298,7 +338,8 @@ func (c *L2b) Instance(backend bind.ContractBackend, addr common.Address) *bind.
} }
// PackDo is the Go binding used to pack the parameters required for calling // PackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l2b *L2b) PackDo(val *big.Int) []byte { func (l2b *L2b) PackDo(val *big.Int) []byte {
@ -309,6 +350,15 @@ func (l2b *L2b) PackDo(val *big.Int) []byte {
return enc return enc
} }
// TryPackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Do(uint256 val) pure returns(uint256)
func (l2b *L2b) TryPackDo(val *big.Int) ([]byte, error) {
return l2b.abi.Pack("Do", val)
}
// UnpackDo is the Go binding that unpacks the parameters returned // UnpackDo is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x2ad11272. // from invoking the contract method with ID 0x2ad11272.
// //
@ -319,7 +369,7 @@ func (l2b *L2b) UnpackDo(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// L3MetaData contains all meta data concerning the L3 contract. // L3MetaData contains all meta data concerning the L3 contract.
@ -350,7 +400,8 @@ func (c *L3) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
} }
// PackDo is the Go binding used to pack the parameters required for calling // PackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l3 *L3) PackDo(val *big.Int) []byte { func (l3 *L3) PackDo(val *big.Int) []byte {
@ -361,6 +412,15 @@ func (l3 *L3) PackDo(val *big.Int) []byte {
return enc return enc
} }
// TryPackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Do(uint256 val) pure returns(uint256)
func (l3 *L3) TryPackDo(val *big.Int) ([]byte, error) {
return l3.abi.Pack("Do", val)
}
// UnpackDo is the Go binding that unpacks the parameters returned // UnpackDo is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x2ad11272. // from invoking the contract method with ID 0x2ad11272.
// //
@ -371,7 +431,7 @@ func (l3 *L3) UnpackDo(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// L4MetaData contains all meta data concerning the L4 contract. // L4MetaData contains all meta data concerning the L4 contract.
@ -406,7 +466,8 @@ func (c *L4) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
} }
// PackDo is the Go binding used to pack the parameters required for calling // PackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l4 *L4) PackDo(val *big.Int) []byte { func (l4 *L4) PackDo(val *big.Int) []byte {
@ -417,6 +478,15 @@ func (l4 *L4) PackDo(val *big.Int) []byte {
return enc return enc
} }
// TryPackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Do(uint256 val) pure returns(uint256)
func (l4 *L4) TryPackDo(val *big.Int) ([]byte, error) {
return l4.abi.Pack("Do", val)
}
// UnpackDo is the Go binding that unpacks the parameters returned // UnpackDo is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x2ad11272. // from invoking the contract method with ID 0x2ad11272.
// //
@ -427,7 +497,7 @@ func (l4 *L4) UnpackDo(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }
// L4bMetaData contains all meta data concerning the L4b contract. // L4bMetaData contains all meta data concerning the L4b contract.
@ -461,7 +531,8 @@ func (c *L4b) Instance(backend bind.ContractBackend, addr common.Address) *bind.
} }
// PackDo is the Go binding used to pack the parameters required for calling // PackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. // the contract method with ID 0x2ad11272. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Do(uint256 val) pure returns(uint256) // Solidity: function Do(uint256 val) pure returns(uint256)
func (l4b *L4b) PackDo(val *big.Int) []byte { func (l4b *L4b) PackDo(val *big.Int) []byte {
@ -472,6 +543,15 @@ func (l4b *L4b) PackDo(val *big.Int) []byte {
return enc return enc
} }
// TryPackDo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0x2ad11272. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Do(uint256 val) pure returns(uint256)
func (l4b *L4b) TryPackDo(val *big.Int) ([]byte, error) {
return l4b.abi.Pack("Do", val)
}
// UnpackDo is the Go binding that unpacks the parameters returned // UnpackDo is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0x2ad11272. // from invoking the contract method with ID 0x2ad11272.
// //
@ -482,5 +562,5 @@ func (l4b *L4b) UnpackDo(data []byte) (*big.Int, error) {
return new(big.Int), err return new(big.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int)
return out0, err return out0, nil
} }

View file

@ -52,7 +52,8 @@ func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.Bo
} }
// PackBar is the Go binding used to pack the parameters required for calling // PackBar is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xb0a378b0. // the contract method with ID 0xb0a378b0. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Bar() pure returns() // Solidity: function Bar() pure returns()
func (c *C) PackBar() []byte { func (c *C) PackBar() []byte {
@ -63,8 +64,18 @@ func (c *C) PackBar() []byte {
return enc return enc
} }
// TryPackBar is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xb0a378b0. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Bar() pure returns()
func (c *C) TryPackBar() ([]byte, error) {
return c.abi.Pack("Bar")
}
// PackFoo is the Go binding used to pack the parameters required for calling // PackFoo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xbfb4ebcf. // the contract method with ID 0xbfb4ebcf. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Foo() pure returns() // Solidity: function Foo() pure returns()
func (c *C) PackFoo() []byte { func (c *C) PackFoo() []byte {
@ -75,6 +86,15 @@ func (c *C) PackFoo() []byte {
return enc return enc
} }
// TryPackFoo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xbfb4ebcf. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Foo() pure returns()
func (c *C) TryPackFoo() ([]byte, error) {
return c.abi.Pack("Foo")
}
// UnpackError attempts to decode the provided error data using user-defined // UnpackError attempts to decode the provided error data using user-defined
// error definitions. // error definitions.
func (c *C) UnpackError(raw []byte) (any, error) { func (c *C) UnpackError(raw []byte) (any, error) {
@ -169,7 +189,8 @@ func (c *C2) Instance(backend bind.ContractBackend, addr common.Address) *bind.B
} }
// PackFoo is the Go binding used to pack the parameters required for calling // PackFoo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xbfb4ebcf. // the contract method with ID 0xbfb4ebcf. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function Foo() pure returns() // Solidity: function Foo() pure returns()
func (c2 *C2) PackFoo() []byte { func (c2 *C2) PackFoo() []byte {
@ -180,6 +201,15 @@ func (c2 *C2) PackFoo() []byte {
return enc return enc
} }
// TryPackFoo is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xbfb4ebcf. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function Foo() pure returns()
func (c2 *C2) TryPackFoo() ([]byte, error) {
return c2.abi.Pack("Foo")
}
// UnpackError attempts to decode the provided error data using user-defined // UnpackError attempts to decode the provided error data using user-defined
// error definitions. // error definitions.
func (c2 *C2) UnpackError(raw []byte) (any, error) { func (c2 *C2) UnpackError(raw []byte) (any, error) {

View file

@ -52,7 +52,8 @@ func (c *MyContract) Instance(backend bind.ContractBackend, addr common.Address)
} }
// PackGetNums is the Go binding used to pack the parameters required for calling // PackGetNums is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xbd6d1007. // the contract method with ID 0xbd6d1007. This method will panic if any
// invalid/nil inputs are passed.
// //
// Solidity: function GetNums() pure returns(uint256[5]) // Solidity: function GetNums() pure returns(uint256[5])
func (myContract *MyContract) PackGetNums() []byte { func (myContract *MyContract) PackGetNums() []byte {
@ -63,6 +64,15 @@ func (myContract *MyContract) PackGetNums() []byte {
return enc return enc
} }
// TryPackGetNums is the Go binding used to pack the parameters required for calling
// the contract method with ID 0xbd6d1007. This method will return an error
// if any inputs are invalid/nil.
//
// Solidity: function GetNums() pure returns(uint256[5])
func (myContract *MyContract) TryPackGetNums() ([]byte, error) {
return myContract.abi.Pack("GetNums")
}
// UnpackGetNums is the Go binding that unpacks the parameters returned // UnpackGetNums is the Go binding that unpacks the parameters returned
// from invoking the contract method with ID 0xbd6d1007. // from invoking the contract method with ID 0xbd6d1007.
// //
@ -73,5 +83,5 @@ func (myContract *MyContract) UnpackGetNums(data []byte) ([5]*big.Int, error) {
return *new([5]*big.Int), err return *new([5]*big.Int), err
} }
out0 := *abi.ConvertType(out[0], new([5]*big.Int)).(*[5]*big.Int) out0 := *abi.ConvertType(out[0], new([5]*big.Int)).(*[5]*big.Int)
return out0, err return out0, nil
} }

View file

@ -28,6 +28,7 @@ package bind
import ( import (
"errors" "errors"
"math/big"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi"
@ -241,3 +242,27 @@ func DefaultDeployer(opts *TransactOpts, backend ContractBackend) DeployFn {
return addr, tx, nil return addr, tx, nil
} }
} }
// DeployerWithNonceAssignment is basically identical to DefaultDeployer,
// but it additionally tracks the nonce to enable automatic assignment.
//
// This is especially useful when deploying multiple contracts
// from the same address — whether they are independent contracts
// or part of a dependency chain that must be deployed in order.
func DeployerWithNonceAssignment(opts *TransactOpts, backend ContractBackend) DeployFn {
var pendingNonce int64
if opts.Nonce != nil {
pendingNonce = opts.Nonce.Int64()
}
return func(input []byte, deployer []byte) (common.Address, *types.Transaction, error) {
if pendingNonce != 0 {
opts.Nonce = big.NewInt(pendingNonce)
}
addr, tx, err := DeployContract(opts, deployer, backend, input)
if err != nil {
return common.Address{}, nil, err
}
pendingNonce = int64(tx.Nonce() + 1)
return addr, tx, nil
}
}

View file

@ -65,6 +65,14 @@ func makeTestDeployer(backend simulated.Client) func(input, deployer []byte) (co
return bind.DefaultDeployer(bind.NewKeyedTransactor(testKey, chainId), backend) return bind.DefaultDeployer(bind.NewKeyedTransactor(testKey, chainId), backend)
} }
// makeTestDeployerWithNonceAssignment is similar to makeTestDeployer,
// but it returns a deployer that automatically tracks nonce,
// enabling the deployment of multiple contracts from the same account.
func makeTestDeployerWithNonceAssignment(backend simulated.Client) func(input, deployer []byte) (common.Address, *types.Transaction, error) {
chainId, _ := backend.ChainID(context.Background())
return bind.DeployerWithNonceAssignment(bind.NewKeyedTransactor(testKey, chainId), backend)
}
// test that deploying a contract with library dependencies works, // test that deploying a contract with library dependencies works,
// verifying by calling method on the deployed contract. // verifying by calling method on the deployed contract.
func TestDeploymentLibraries(t *testing.T) { func TestDeploymentLibraries(t *testing.T) {
@ -80,7 +88,7 @@ func TestDeploymentLibraries(t *testing.T) {
Contracts: []*bind.MetaData{&nested_libraries.C1MetaData}, Contracts: []*bind.MetaData{&nested_libraries.C1MetaData},
Inputs: map[string][]byte{nested_libraries.C1MetaData.ID: constructorInput}, Inputs: map[string][]byte{nested_libraries.C1MetaData.ID: constructorInput},
} }
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployer(bindBackend.Client)) res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployerWithNonceAssignment(bindBackend.Client))
if err != nil { if err != nil {
t.Fatalf("err: %+v\n", err) t.Fatalf("err: %+v\n", err)
} }
@ -122,7 +130,7 @@ func TestDeploymentWithOverrides(t *testing.T) {
deploymentParams := &bind.DeploymentParams{ deploymentParams := &bind.DeploymentParams{
Contracts: nested_libraries.C1MetaData.Deps, Contracts: nested_libraries.C1MetaData.Deps,
} }
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployer(bindBackend)) res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployerWithNonceAssignment(bindBackend))
if err != nil { if err != nil {
t.Fatalf("err: %+v\n", err) t.Fatalf("err: %+v\n", err)
} }

View file

@ -17,7 +17,7 @@
// Package keystore implements encrypted storage of secp256k1 private keys. // Package keystore implements encrypted storage of secp256k1 private keys.
// //
// Keys are stored as encrypted JSON files according to the Web3 Secret Storage specification. // Keys are stored as encrypted JSON files according to the Web3 Secret Storage specification.
// See https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition for more information. // See https://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/ for more information.
package keystore package keystore
import ( import (

View file

@ -19,7 +19,7 @@
This key store behaves as KeyStorePlain with the difference that This key store behaves as KeyStorePlain with the difference that
the private key is encrypted and on disk uses another JSON encoding. the private key is encrypted and on disk uses another JSON encoding.
The crypto is documented at https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition The crypto is documented at https://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/
*/ */

View file

@ -34,21 +34,13 @@ func TestBlobs(t *testing.T) {
header := types.Header{} header := types.Header{}
block := types.NewBlock(&header, &types.Body{}, nil, nil) block := types.NewBlock(&header, &types.Body{}, nil, nil)
sidecarWithoutCellProofs := &types.BlobTxSidecar{ sidecarWithoutCellProofs := types.NewBlobTxSidecar(types.BlobSidecarVersion0, []kzg4844.Blob{*emptyBlob}, []kzg4844.Commitment{emptyBlobCommit}, []kzg4844.Proof{emptyBlobProof})
Blobs: []kzg4844.Blob{*emptyBlob},
Commitments: []kzg4844.Commitment{emptyBlobCommit},
Proofs: []kzg4844.Proof{emptyBlobProof},
}
env := BlockToExecutableData(block, common.Big0, []*types.BlobTxSidecar{sidecarWithoutCellProofs}, nil) env := BlockToExecutableData(block, common.Big0, []*types.BlobTxSidecar{sidecarWithoutCellProofs}, nil)
if len(env.BlobsBundle.Proofs) != 1 { if len(env.BlobsBundle.Proofs) != 1 {
t.Fatalf("Expect 1 proof in blobs bundle, got %v", len(env.BlobsBundle.Proofs)) t.Fatalf("Expect 1 proof in blobs bundle, got %v", len(env.BlobsBundle.Proofs))
} }
sidecarWithCellProofs := &types.BlobTxSidecar{ sidecarWithCellProofs := types.NewBlobTxSidecar(types.BlobSidecarVersion0, []kzg4844.Blob{*emptyBlob}, []kzg4844.Commitment{emptyBlobCommit}, emptyCellProof)
Blobs: []kzg4844.Blob{*emptyBlob},
Commitments: []kzg4844.Commitment{emptyBlobCommit},
Proofs: emptyCellProof,
}
env = BlockToExecutableData(block, common.Big0, []*types.BlobTxSidecar{sidecarWithCellProofs}, nil) env = BlockToExecutableData(block, common.Big0, []*types.BlobTxSidecar{sidecarWithCellProofs}, nil)
if len(env.BlobsBundle.Proofs) != 128 { if len(env.BlobsBundle.Proofs) != 128 {
t.Fatalf("Expect 128 proofs in blobs bundle, got %v", len(env.BlobsBundle.Proofs)) t.Fatalf("Expect 128 proofs in blobs bundle, got %v", len(env.BlobsBundle.Proofs))

View file

@ -1 +1 @@
0xd60e5310c5d52ced44cfb13be4e9f22a1e6a6dc56964c3cccd429182d26d72d0 0x4bae4b97deda095724560012cab1f80a5221ce0a37a4b5236d8ab63f595f29d9

View file

@ -0,0 +1 @@
0x1bbf958008172591b6cbdb3d8d52e26998258e83d4bdb9eec10969d84519a6bd

View file

@ -1 +1 @@
0x02f0bb348b0d45f95a9b7e2bb5705768ad06548876cee03d880a2c9dabb1ff88 0x2fe39a39b6f7cbd549e0f74d259de6db486005a65bd3bd92840dd6ce21d6f4c8

View file

@ -1 +1 @@
0xa0dad451a230c01be6f2492980ec5bb412d8cf33351a75e8b172b5b84a5fd03a 0x86686b2b366e24134e0e3969a9c5f3759f92e5d2b04785b42e22cc7d468c2107

View file

@ -31,6 +31,9 @@ var checkpointSepolia string
//go:embed checkpoint_holesky.hex //go:embed checkpoint_holesky.hex
var checkpointHolesky string var checkpointHolesky string
//go:embed checkpoint_hoodi.hex
var checkpointHoodi string
var ( var (
MainnetLightConfig = (&ChainConfig{ MainnetLightConfig = (&ChainConfig{
GenesisValidatorsRoot: common.HexToHash("0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"), GenesisValidatorsRoot: common.HexToHash("0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"),
@ -71,7 +74,7 @@ var (
HoodiLightConfig = (&ChainConfig{ HoodiLightConfig = (&ChainConfig{
GenesisValidatorsRoot: common.HexToHash("0x212f13fc4df078b6cb7db228f1c8307566dcecf900867401a92023d7ba99cb5f"), GenesisValidatorsRoot: common.HexToHash("0x212f13fc4df078b6cb7db228f1c8307566dcecf900867401a92023d7ba99cb5f"),
GenesisTime: 1742212800, GenesisTime: 1742212800,
Checkpoint: common.HexToHash(""), Checkpoint: common.HexToHash(checkpointHoodi),
}). }).
AddFork("GENESIS", 0, common.FromHex("0x10000910")). AddFork("GENESIS", 0, common.FromHex("0x10000910")).
AddFork("ALTAIR", 0, common.FromHex("0x20000910")). AddFork("ALTAIR", 0, common.FromHex("0x20000910")).

View file

@ -1,9 +1,9 @@
# This file contains sha256 checksums of optional build dependencies. # This file contains sha256 checksums of optional build dependencies.
# version:spec-tests v4.5.0 # version:spec-tests fusaka-devnet-3%40v1.0.0
# https://github.com/ethereum/execution-spec-tests/releases # https://github.com/ethereum/execution-spec-tests/releases
# https://github.com/ethereum/execution-spec-tests/releases/download/v4.5.0/ # https://github.com/ethereum/execution-spec-tests/releases/download/fusaka-devnet-3%40v1.0.0
58afb92a0075a2cb7c4dec1281f7cb88b21b02afbedad096b580f3f8cc14c54c fixtures_develop.tar.gz 576261e1280e5300c458aa9b05eccb2fec5ff80a0005940dc52fa03fdd907249 fixtures_fusaka-devnet-3.tar.gz
# version:golang 1.24.4 # version:golang 1.24.4
# https://go.dev/dl/ # https://go.dev/dl/

View file

@ -332,7 +332,7 @@ func doTest(cmdline []string) {
// downloadSpecTestFixtures downloads and extracts the execution-spec-tests fixtures. // downloadSpecTestFixtures downloads and extracts the execution-spec-tests fixtures.
func downloadSpecTestFixtures(csdb *download.ChecksumDB, cachedir string) string { func downloadSpecTestFixtures(csdb *download.ChecksumDB, cachedir string) string {
ext := ".tar.gz" ext := ".tar.gz"
base := "fixtures_develop" base := "fixtures_fusaka-devnet-3"
archivePath := filepath.Join(cachedir, base+ext) archivePath := filepath.Join(cachedir, base+ext)
if err := csdb.DownloadFileFromKnownURL(archivePath); err != nil { if err := csdb.DownloadFileFromKnownURL(archivePath); err != nil {
log.Fatal(err) log.Fatal(err)

View file

@ -65,7 +65,7 @@ The API-method `account_signGnosisSafeTx` was added. This method takes two param
``` ```
Not all fields are required, though. This method is really just a UX helper, which massages the Not all fields are required, though. This method is really just a UX helper, which massages the
input to conform to the `EIP-712` [specification](https://docs.gnosis.io/safe/docs/contracts_tx_execution/#transaction-hash) input to conform to the `EIP-712` [specification](https://docs.safe.global/core-api/transaction-service-reference/gnosis)
for the Gnosis Safe, and making the output be directly importable to by a relay service. for the Gnosis Safe, and making the output be directly importable to by a relay service.

View file

@ -129,7 +129,7 @@ func (c *Conn) Write(proto Proto, code uint64, msg any) error {
return err return err
} }
var errDisc error = fmt.Errorf("disconnect") var errDisc error = errors.New("disconnect")
// ReadEth reads an Eth sub-protocol wire message. // ReadEth reads an Eth sub-protocol wire message.
func (c *Conn) ReadEth() (any, error) { func (c *Conn) ReadEth() (any, error) {

View file

@ -19,6 +19,7 @@ package ethtest
import ( import (
"context" "context"
"crypto/rand" "crypto/rand"
"errors"
"fmt" "fmt"
"reflect" "reflect"
"sync" "sync"
@ -879,11 +880,7 @@ func makeSidecar(data ...byte) *types.BlobTxSidecar {
commitments = append(commitments, c) commitments = append(commitments, c)
proofs = append(proofs, p) proofs = append(proofs, p)
} }
return &types.BlobTxSidecar{ return types.NewBlobTxSidecar(types.BlobSidecarVersion0, blobs, commitments, proofs)
Blobs: blobs,
Commitments: commitments,
Proofs: proofs,
}
} }
func (s *Suite) makeBlobTxs(count, blobs int, discriminator byte) (txs types.Transactions) { func (s *Suite) makeBlobTxs(count, blobs int, discriminator byte) (txs types.Transactions) {
@ -988,14 +985,10 @@ func (s *Suite) TestBlobViolations(t *utesting.T) {
// data has been modified to produce a different commitment hash. // data has been modified to produce a different commitment hash.
func mangleSidecar(tx *types.Transaction) *types.Transaction { func mangleSidecar(tx *types.Transaction) *types.Transaction {
sidecar := tx.BlobTxSidecar() sidecar := tx.BlobTxSidecar()
copy := types.BlobTxSidecar{ cpy := sidecar.Copy()
Blobs: append([]kzg4844.Blob{}, sidecar.Blobs...),
Commitments: append([]kzg4844.Commitment{}, sidecar.Commitments...),
Proofs: append([]kzg4844.Proof{}, sidecar.Proofs...),
}
// zero the first commitment to alter the sidecar hash // zero the first commitment to alter the sidecar hash
copy.Commitments[0] = kzg4844.Commitment{} cpy.Commitments[0] = kzg4844.Commitment{}
return tx.WithBlobTxSidecar(&copy) return tx.WithBlobTxSidecar(cpy)
} }
func (s *Suite) TestBlobTxWithoutSidecar(t *utesting.T) { func (s *Suite) TestBlobTxWithoutSidecar(t *utesting.T) {
@ -1100,7 +1093,7 @@ func (s *Suite) testBadBlobTx(t *utesting.T, tx *types.Transaction, badTx *types
return return
} }
if !readUntilDisconnect(conn) { if !readUntilDisconnect(conn) {
errc <- fmt.Errorf("expected bad peer to be disconnected") errc <- errors.New("expected bad peer to be disconnected")
return return
} }
stage3.Done() stage3.Done()
@ -1147,7 +1140,7 @@ func (s *Suite) testBadBlobTx(t *utesting.T, tx *types.Transaction, badTx *types
} }
if req.GetPooledTransactionsRequest[0] != tx.Hash() { if req.GetPooledTransactionsRequest[0] != tx.Hash() {
errc <- fmt.Errorf("requested unknown tx hash") errc <- errors.New("requested unknown tx hash")
return return
} }
@ -1157,7 +1150,7 @@ func (s *Suite) testBadBlobTx(t *utesting.T, tx *types.Transaction, badTx *types
return return
} }
if readUntilDisconnect(conn) { if readUntilDisconnect(conn) {
errc <- fmt.Errorf("unexpected disconnect") errc <- errors.New("unexpected disconnect")
return return
} }
close(errc) close(errc)

View file

@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/internal/utesting" "github.com/ethereum/go-ethereum/internal/utesting"
"github.com/ethereum/go-ethereum/p2p/discover/v4wire" "github.com/ethereum/go-ethereum/p2p/discover/v4wire"
"github.com/ethereum/go-ethereum/p2p/enode"
) )
const ( const (
@ -501,6 +502,36 @@ func FindnodeAmplificationWrongIP(t *utesting.T) {
} }
} }
func ENRRequest(t *utesting.T) {
t.Log(`This test sends an ENRRequest packet and expects a response containing a valid ENR.`)
te := newTestEnv(Remote, Listen1, Listen2)
defer te.close()
bond(t, te)
req := &v4wire.ENRRequest{Expiration: futureExpiration()}
hash := te.send(te.l1, req)
response, _, err := te.read(te.l1)
if err != nil {
t.Fatal("read error:", err)
}
enrResp, ok := response.(*v4wire.ENRResponse)
if !ok {
t.Fatalf("expected ENRResponse packet, got %T", response)
}
if !bytes.Equal(enrResp.ReplyTok, hash) {
t.Errorf("wrong hash in response packet: got %x, want %x", enrResp.ReplyTok, hash)
}
node, err := enode.New(enode.ValidSchemes, &enrResp.Record)
if err != nil {
t.Errorf("invalid record in response: %v", err)
}
if node.ID() != te.remote.ID() {
t.Errorf("wrong node ID in response: got %v, want %v", node.ID(), te.remote.ID())
}
}
var AllTests = []utesting.Test{ var AllTests = []utesting.Test{
{Name: "Ping/Basic", Fn: BasicPing}, {Name: "Ping/Basic", Fn: BasicPing},
{Name: "Ping/WrongTo", Fn: PingWrongTo}, {Name: "Ping/WrongTo", Fn: PingWrongTo},
@ -510,6 +541,7 @@ var AllTests = []utesting.Test{
{Name: "Ping/PastExpiration", Fn: PingPastExpiration}, {Name: "Ping/PastExpiration", Fn: PingPastExpiration},
{Name: "Ping/WrongPacketType", Fn: WrongPacketType}, {Name: "Ping/WrongPacketType", Fn: WrongPacketType},
{Name: "Ping/BondThenPingWithWrongFrom", Fn: BondThenPingWithWrongFrom}, {Name: "Ping/BondThenPingWithWrongFrom", Fn: BondThenPingWithWrongFrom},
{Name: "ENRRequest", Fn: ENRRequest},
{Name: "Findnode/WithoutEndpointProof", Fn: FindnodeWithoutEndpointProof}, {Name: "Findnode/WithoutEndpointProof", Fn: FindnodeWithoutEndpointProof},
{Name: "Findnode/BasicFindnode", Fn: BasicFindnode}, {Name: "Findnode/BasicFindnode", Fn: BasicFindnode},
{Name: "Findnode/UnsolicitedNeighbors", Fn: UnsolicitedNeighbors}, {Name: "Findnode/UnsolicitedNeighbors", Fn: UnsolicitedNeighbors},

View file

@ -183,6 +183,9 @@ func Transaction(ctx *cli.Context) error {
if chainConfig.IsShanghai(new(big.Int), 0) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize { if chainConfig.IsShanghai(new(big.Int), 0) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
r.Error = errors.New("max initcode size exceeded") r.Error = errors.New("max initcode size exceeded")
} }
if chainConfig.IsOsaka(new(big.Int), 0) && tx.Gas() > params.MaxTxGas {
r.Error = errors.New("gas limit exceeds maximum")
}
results = append(results, r) results = append(results, r)
} }
out, err := json.MarshalIndent(results, "", " ") out, err := json.MarshalIndent(results, "", " ")

View file

@ -576,8 +576,8 @@ func parseDumpConfig(ctx *cli.Context, db ethdb.Database) (*state.DumpConfig, co
arg := ctx.Args().First() arg := ctx.Args().First()
if hashish(arg) { if hashish(arg) {
hash := common.HexToHash(arg) hash := common.HexToHash(arg)
if number := rawdb.ReadHeaderNumber(db, hash); number != nil { if number, ok := rawdb.ReadHeaderNumber(db, hash); ok {
header = rawdb.ReadHeader(db, hash, *number) header = rawdb.ReadHeader(db, hash, number)
} else { } else {
return nil, common.Hash{}, fmt.Errorf("block %x not found", hash) return nil, common.Hash{}, fmt.Errorf("block %x not found", hash)
} }
@ -716,7 +716,7 @@ func downloadEra(ctx *cli.Context) error {
case ctx.IsSet(utils.SepoliaFlag.Name): case ctx.IsSet(utils.SepoliaFlag.Name):
network = "sepolia" network = "sepolia"
default: default:
return fmt.Errorf("unsupported network, no known era1 checksums") return errors.New("unsupported network, no known era1 checksums")
} }
} }

View file

@ -262,14 +262,16 @@ func makeFullNode(ctx *cli.Context) *node.Node {
if cfg.Ethstats.URL != "" { if cfg.Ethstats.URL != "" {
utils.RegisterEthStatsService(stack, backend, cfg.Ethstats.URL) utils.RegisterEthStatsService(stack, backend, cfg.Ethstats.URL)
} }
// Configure full-sync tester service if requested // Configure synchronization override service
var synctarget common.Hash
if ctx.IsSet(utils.SyncTargetFlag.Name) { if ctx.IsSet(utils.SyncTargetFlag.Name) {
hex := hexutil.MustDecode(ctx.String(utils.SyncTargetFlag.Name)) hex := hexutil.MustDecode(ctx.String(utils.SyncTargetFlag.Name))
if len(hex) != common.HashLength { if len(hex) != common.HashLength {
utils.Fatalf("invalid sync target length: have %d, want %d", len(hex), common.HashLength) utils.Fatalf("invalid sync target length: have %d, want %d", len(hex), common.HashLength)
} }
utils.RegisterFullSyncTester(stack, eth, common.BytesToHash(hex)) synctarget = common.BytesToHash(hex)
} }
utils.RegisterSyncOverrideService(stack, eth, synctarget, ctx.Bool(utils.ExitWhenSyncedFlag.Name))
if ctx.IsSet(utils.DeveloperFlag.Name) { if ctx.IsSet(utils.DeveloperFlag.Name) {
// Start dev mode. // Start dev mode.

View file

@ -6,28 +6,33 @@
"description": "A mining flaw could cause miners to erroneously calculate PoW, due to an index overflow, if DAG size is exceeding the maximum 32 bit unsigned value.\n\nThis occurred on the ETC chain on 2020-11-06. This is likely to trigger for ETH mainnet around block `11550000`/epoch `385`, slated to occur early January 2021.\n\nThis issue is relevant only for miners, non-mining nodes are unaffected, since non-mining nodes use a smaller verification cache instead of a full DAG.", "description": "A mining flaw could cause miners to erroneously calculate PoW, due to an index overflow, if DAG size is exceeding the maximum 32 bit unsigned value.\n\nThis occurred on the ETC chain on 2020-11-06. This is likely to trigger for ETH mainnet around block `11550000`/epoch `385`, slated to occur early January 2021.\n\nThis issue is relevant only for miners, non-mining nodes are unaffected, since non-mining nodes use a smaller verification cache instead of a full DAG.",
"links": [ "links": [
"https://github.com/ethereum/go-ethereum/pull/21793", "https://github.com/ethereum/go-ethereum/pull/21793",
"https://blog.ethereum.org/2020/11/12/geth_security_release/", "https://blog.ethereum.org/2020/11/12/geth-security-release",
"https://github.com/ethereum/go-ethereum/commit/567d41d9363706b4b13ce0903804e8acf214af49" "https://github.com/ethereum/go-ethereum/commit/567d41d9363706b4b13ce0903804e8acf214af49",
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-v592-xf75-856p"
], ],
"introduced": "v1.6.0", "introduced": "v1.6.0",
"fixed": "v1.9.24", "fixed": "v1.9.24",
"published": "2020-11-12", "published": "2020-11-12",
"severity": "Medium", "severity": "Medium",
"check": "Geth\\/v1\\.(6|7|8)\\..*|Geth\\/v1\\.9\\.2(1|2|3)-.*" "CVE": "CVE-2020-26240",
"check": "Geth\\/v1\\.(6|7|8)\\..*|Geth\\/v1\\.9\\.\\d-.*|Geth\\/v1\\.9\\.1.*|Geth\\/v1\\.9\\.2(0|1|2|3)-.*"
}, },
{ {
"name": "GoCrash", "name": "Denial of service due to Go CVE-2020-28362",
"uid": "GETH-2020-02", "uid": "GETH-2020-02",
"summary": "A denial-of-service issue can be used to crash Geth nodes during block processing, due to an underlying bug in Go (CVE-2020-28362) versions < `1.15.5`, or `<1.14.12`", "summary": "A denial-of-service issue can be used to crash Geth nodes during block processing, due to an underlying bug in Go (CVE-2020-28362) versions < `1.15.5`, or `<1.14.12`",
"description": "The DoS issue can be used to crash all Geth nodes during block processing, the effects of which would be that a major part of the Ethereum network went offline.\n\nOutside of Go-Ethereum, the issue is most likely relevant for all forks of Geth (such as TurboGeth or ETCs core-geth) which is built with versions of Go which contains the vulnerability.", "description": "The DoS issue can be used to crash all Geth nodes during block processing, the effects of which would be that a major part of the Ethereum network went offline.\n\nOutside of Go-Ethereum, the issue is most likely relevant for all forks of Geth (such as TurboGeth or ETCs core-geth) which is built with versions of Go which contains the vulnerability.",
"links": [ "links": [
"https://blog.ethereum.org/2020/11/12/geth_security_release/", "https://blog.ethereum.org/2020/11/12/geth-security-release",
"https://groups.google.com/g/golang-announce/c/NpBGTTmKzpM", "https://groups.google.com/g/golang-announce/c/NpBGTTmKzpM",
"https://github.com/golang/go/issues/42552" "https://github.com/golang/go/issues/42552",
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-m6gx-rhvj-fh52"
], ],
"introduced": "v0.0.0",
"fixed": "v1.9.24", "fixed": "v1.9.24",
"published": "2020-11-12", "published": "2020-11-12",
"severity": "Critical", "severity": "Critical",
"CVE": "CVE-2020-28362",
"check": "Geth.*\\/go1\\.(11(.*)|12(.*)|13(.*)|14|14\\.(\\d|10|11|)|15|15\\.[0-4])$" "check": "Geth.*\\/go1\\.(11(.*)|12(.*)|13(.*)|14|14\\.(\\d|10|11|)|15|15\\.[0-4])$"
}, },
{ {
@ -36,26 +41,162 @@
"summary": "A consensus flaw in Geth, related to `datacopy` precompile", "summary": "A consensus flaw in Geth, related to `datacopy` precompile",
"description": "Geth erroneously performed a 'shallow' copy when the precompiled `datacopy` (at `0x00...04`) was invoked. An attacker could deploy a contract that uses the shallow copy to corrupt the contents of the `RETURNDATA`, thus causing a consensus failure.", "description": "Geth erroneously performed a 'shallow' copy when the precompiled `datacopy` (at `0x00...04`) was invoked. An attacker could deploy a contract that uses the shallow copy to corrupt the contents of the `RETURNDATA`, thus causing a consensus failure.",
"links": [ "links": [
"https://blog.ethereum.org/2020/11/12/geth_security_release/" "https://blog.ethereum.org/2020/11/12/geth-security-release",
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-69v6-xc2j-r2jf"
], ],
"introduced": "v1.9.7", "introduced": "v1.9.7",
"fixed": "v1.9.17", "fixed": "v1.9.17",
"published": "2020-11-12", "published": "2020-11-12",
"severity": "Critical", "severity": "Critical",
"CVE": "CVE-2020-26241",
"check": "Geth\\/v1\\.9\\.(7|8|9|10|11|12|13|14|15|16).*$" "check": "Geth\\/v1\\.9\\.(7|8|9|10|11|12|13|14|15|16).*$"
}, },
{ {
"name": "GethCrash", "name": "Geth DoS via MULMOD",
"uid": "GETH-2020-04", "uid": "GETH-2020-04",
"summary": "A denial-of-service issue can be used to crash Geth nodes during block processing", "summary": "A denial-of-service issue can be used to crash Geth nodes during block processing",
"description": "Full details to be disclosed at a later date", "description": "Affected versions suffer from a vulnerability which can be exploited through the `MULMOD` operation, by specifying a modulo of `0`: `mulmod(a,b,0)`, causing a `panic` in the underlying library. \nThe crash was in the `uint256` library, where a buffer [underflowed](https://github.com/holiman/uint256/blob/4ce82e695c10ddad57215bdbeafb68b8c5df2c30/uint256.go#L442).\n\n\tif `d == 0`, `dLen` remains `0`\n\nand https://github.com/holiman/uint256/blob/4ce82e695c10ddad57215bdbeafb68b8c5df2c30/uint256.go#L451 will try to access index `[-1]`.\n\nThe `uint256` library was first merged in this [commit](https://github.com/ethereum/go-ethereum/commit/cf6674539c589f80031f3371a71c6a80addbe454), on 2020-06-08. \nExploiting this vulnerabilty would cause all vulnerable nodes to drop off the network. \n\nThe issue was brought to our attention through a [bug report](https://github.com/ethereum/go-ethereum/issues/21367), showing a `panic` occurring on sync from genesis on the Ropsten network.\n \nIt was estimated that the least obvious way to fix this would be to merge the fix into `uint256`, make a new release of that library and then update the geth-dependency.\n",
"links": [ "links": [
"https://blog.ethereum.org/2020/11/12/geth_security_release/" "https://blog.ethereum.org/2020/11/12/geth-security-release",
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-jm5c-rv3w-w83m",
"https://github.com/holiman/uint256/releases/tag/v1.1.1",
"https://github.com/holiman/uint256/pull/80",
"https://github.com/ethereum/go-ethereum/pull/21368"
], ],
"introduced": "v1.9.16", "introduced": "v1.9.16",
"fixed": "v1.9.18", "fixed": "v1.9.18",
"published": "2020-11-12", "published": "2020-11-12",
"severity": "Critical", "severity": "Critical",
"CVE": "CVE-2020-26242",
"check": "Geth\\/v1\\.9.(16|17).*$" "check": "Geth\\/v1\\.9.(16|17).*$"
},
{
"name": "LES Server DoS via GetProofsV2",
"uid": "GETH-2020-05",
"summary": "A DoS vulnerability can make a LES server crash.",
"description": "A DoS vulnerability can make a LES server crash via malicious GetProofsV2 request from a connected LES client.\n\nThe vulnerability was patched in #21896.\n\nThis vulnerability only concern users explicitly running geth as a light server",
"links": [
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-r33q-22hv-j29q",
"https://github.com/ethereum/go-ethereum/pull/21896"
],
"introduced": "v1.8.0",
"fixed": "v1.9.25",
"published": "2020-12-10",
"severity": "Medium",
"CVE": "CVE-2020-26264",
"check": "(Geth\\/v1\\.8\\.*)|(Geth\\/v1\\.9\\.\\d-.*)|(Geth\\/v1\\.9\\.1\\d-.*)|(Geth\\/v1\\.9\\.(20|21|22|23|24)-.*)$"
},
{
"name": "SELFDESTRUCT-recreate consensus flaw",
"uid": "GETH-2020-06",
"introduced": "v1.9.4",
"fixed": "v1.9.20",
"summary": "A consensus-vulnerability in Geth could cause a chain split, where vulnerable versions refuse to accept the canonical chain.",
"description": "A flaw was repoted at 2020-08-11 by John Youngseok Yang (Software Platform Lab), where a particular sequence of transactions could cause a consensus failure.\n\n- Tx 1:\n - `sender` invokes `caller`.\n - `caller` invokes `0xaa`. `0xaa` has 3 wei, does a self-destruct-to-self\n - `caller` does a `1 wei` -call to `0xaa`, who thereby has 1 wei (the code in `0xaa` still executed, since the tx is still ongoing, but doesn't redo the selfdestruct, it takes a different path if callvalue is non-zero)\n\n-Tx 2:\n - `sender` does a 5-wei call to 0xaa. No exec (since no code). \n\nIn geth, the result would be that `0xaa` had `6 wei`, whereas OE reported (correctly) `5` wei. Furthermore, in geth, if the second tx was not executed, the `0xaa` would be destructed, resulting in `0 wei`. Thus obviously wrong. \n\nIt was determined that the root cause was this [commit](https://github.com/ethereum/go-ethereum/commit/223b950944f494a5b4e0957fd9f92c48b09037ad) from [this PR](https://github.com/ethereum/go-ethereum/pull/19953). The semantics of `createObject` was subtly changd, into returning a non-nil object (with `deleted=true`) where it previously did not if the account had been destructed. This return value caused the new object to inherit the old `balance`.\n",
"links": [
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-xw37-57qp-9mm4"
],
"published": "2020-12-10",
"severity": "High",
"CVE": "CVE-2020-26265",
"check": "(Geth\\/v1\\.9\\.(4|5|6|7|8|9)-.*)|(Geth\\/v1\\.9\\.1\\d-.*)$"
},
{
"name": "Not ready for London upgrade",
"uid": "GETH-2021-01",
"summary": "The client is not ready for the 'London' technical upgrade, and will deviate from the canonical chain when the London upgrade occurs (at block '12965000' around August 4, 2021.",
"description": "At (or around) August 4, Ethereum will undergo a technical upgrade called 'London'. Clients not upgraded will fail to progress on the canonical chain.",
"links": [
"https://github.com/ethereum/eth1.0-specs/blob/master/network-upgrades/mainnet-upgrades/london.md",
"https://notes.ethereum.org/@timbeiko/ropsten-postmortem"
],
"introduced": "v1.10.1",
"fixed": "v1.10.6",
"published": "2021-07-22",
"severity": "High",
"check": "(Geth\\/v1\\.10\\.(1|2|3|4|5)-.*)$"
},
{
"name": "RETURNDATA corruption via datacopy",
"uid": "GETH-2021-02",
"summary": "A consensus-flaw in the Geth EVM could cause a node to deviate from the canonical chain.",
"description": "A memory-corruption bug within the EVM can cause a consensus error, where vulnerable nodes obtain a different `stateRoot` when processing a maliciously crafted transaction. This, in turn, would lead to the chain being split: mainnet splitting in two forks.\n\nAll Geth versions supporting the London hard fork are vulnerable (the bug is older than London), so all users should update.\n\nThis bug was exploited on Mainnet at block 13107518.\n\nCredits for the discovery go to @guidovranken (working for Sentnl during an audit of the Telos EVM) and reported via bounty@ethereum.org.",
"links": [
"https://github.com/ethereum/go-ethereum/blob/master/docs/postmortems/2021-08-22-split-postmortem.md",
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-9856-9gg9-qcmq",
"https://github.com/ethereum/go-ethereum/releases/tag/v1.10.8"
],
"introduced": "v1.10.0",
"fixed": "v1.10.8",
"published": "2021-08-24",
"severity": "High",
"CVE": "CVE-2021-39137",
"check": "(Geth\\/v1\\.10\\.(0|1|2|3|4|5|6|7)-.*)$"
},
{
"name": "DoS via malicious `snap/1` request",
"uid": "GETH-2021-03",
"summary": "A vulnerable node is susceptible to crash when processing a maliciously crafted message from a peer, via the snap/1 protocol. The crash can be triggered by sending a malicious snap/1 GetTrieNodes package.",
"description": "The `snap/1` protocol handler contains two vulnerabilities related to the `GetTrieNodes` packet, which can be exploited to crash the node. Full details are available at the Github security [advisory](https://github.com/ethereum/go-ethereum/security/advisories/GHSA-59hh-656j-3p7v)",
"links": [
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-59hh-656j-3p7v",
"https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities",
"https://github.com/ethereum/go-ethereum/pull/23657"
],
"introduced": "v1.10.0",
"fixed": "v1.10.9",
"published": "2021-10-24",
"severity": "Medium",
"CVE": "CVE-2021-41173",
"check": "(Geth\\/v1\\.10\\.(0|1|2|3|4|5|6|7|8)-.*)$"
},
{
"name": "DoS via malicious p2p message",
"uid": "GETH-2022-01",
"summary": "A vulnerable node can crash via p2p messages sent from an attacker node, if running with non-default log options.",
"description": "A vulnerable node, if configured to use high verbosity logging, can be made to crash when handling specially crafted p2p messages sent from an attacker node. Full details are available at the Github security [advisory](https://github.com/ethereum/go-ethereum/security/advisories/GHSA-wjxw-gh3m-7pm5)",
"links": [
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-wjxw-gh3m-7pm5",
"https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities",
"https://github.com/ethereum/go-ethereum/pull/24507"
],
"introduced": "v1.10.0",
"fixed": "v1.10.17",
"published": "2022-05-11",
"severity": "Low",
"CVE": "CVE-2022-29177",
"check": "(Geth\\/v1\\.10\\.(0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16)-.*)$"
},
{
"name": "DoS via malicious p2p message",
"uid": "GETH-2023-01",
"summary": "A vulnerable node can be made to consume unbounded amounts of memory when handling specially crafted p2p messages sent from an attacker node.",
"description": "The p2p handler spawned a new goroutine to respond to ping requests. By flooding a node with ping requests, an unbounded number of goroutines can be created, leading to resource exhaustion and potentially crash due to OOM.",
"links": [
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-ppjg-v974-84cm",
"https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities"
],
"introduced": "v1.10.0",
"fixed": "v1.12.1",
"published": "2023-09-06",
"severity": "High",
"CVE": "CVE-2023-40591",
"check": "(Geth\\/v1\\.(10|11)\\..*)|(Geth\\/v1\\.12\\.0-.*)$"
},
{
"name": "DoS via malicious p2p message",
"uid": "GETH-2024-01",
"summary": "A vulnerable node can be made to consume very large amounts of memory when handling specially crafted p2p messages sent from an attacker node.",
"description": "A vulnerable node can be made to consume very large amounts of memory when handling specially crafted p2p messages sent from an attacker node. Full details will be available at the Github security [advisory](https://github.com/ethereum/go-ethereum/security/advisories/GHSA-4xc9-8hmq-j652)",
"links": [
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-4xc9-8hmq-j652",
"https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities"
],
"introduced": "v1.10.0",
"fixed": "v1.13.15",
"published": "2024-05-06",
"severity": "High",
"CVE": "CVE-2024-32972",
"check": "(Geth\\/v1\\.(10|11|12)\\..*)|(Geth\\/v1\\.13\\.\\d-.*)|(Geth\\/v1\\.13\\.1(0|1|2|3|4)-.*)$"
} }
] ]

View file

@ -1,4 +1,4 @@
untrusted comment: signature from minisign secret key untrusted comment: signature from minisign secret key
RUQkliYstQBOKLK05Sy5f3bVRMBqJT26ABo6Vbp3BNJAVjejoqYCu4GWE/+7qcDfHBqYIniDCbFIUvYEnOHxV6vZ93wO1xJWDQw= RUQkliYstQBOKHklFEYCUjepz81dyUuDmIAxjAvXa+icjGuKcjtVfV06G7qfOMSpplS5EcntU12n+AnGNyuOM8zIctaIWcfG2w0=
trusted comment: timestamp:1693986492 file:data.json hashed trusted comment: timestamp:1752094689 file:data.json hashed
6Fdw2H+W1ZXK7QXSF77Z5AWC7+AEFAfDmTSxNGylU5HLT1AuSJQmxslj+VjtUBamYCvOuET7plbXza942AlWDw== u2e4wo4HBTU6viQTSY/NVBHoWoPFJnnTvLZS0FYl3JdvSOYi6+qpbEsDhAIFqq/n8VmlS/fPqqf7vKCNiAgjAA==

View file

@ -1,4 +1,4 @@
untrusted comment: signature from minisign secret key untrusted comment: signature from minisign secret key
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0= RWQkliYstQBOKNoyq2O98hPmeVJQ6ShQLM58+4n0gkY0y0trFMDAsHuN/l4IyHfh8dDQ1ry0+IuZVrf/i8M/P3YFzFfAymDYCQ0=
trusted comment: timestamp:1605618622 file:vulnerabilities.json trusted comment: timestamp:1752094703 file:data.json
osAPs4QPdDkmiWQxqeMIzYv/b+ZGxJ+19Sbrk1Cpq4t2gHBT+lqFtwL3OCzKWWyjGRTmHfsVGBYpzEdPRQ0/BQ== cNyq3ZGlqo785HtWODb9ejWqF0HhSeXuLGXzC7z1IhnDrBObWBJngYd3qBG1dQcYlHQ+bgB/On5mSyMFn4UoCQ==

View file

@ -1,4 +1,4 @@
untrusted comment: Here's a comment untrusted comment: Here's a comment
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0= RWQkliYstQBOKNoyq2O98hPmeVJQ6ShQLM58+4n0gkY0y0trFMDAsHuN/l4IyHfh8dDQ1ry0+IuZVrf/i8M/P3YFzFfAymDYCQ0=
trusted comment: Here's a trusted comment trusted comment: Here's a trusted comment
3CnkIuz9MEDa7uNyGZAbKZhuirwfiqm7E1uQHrd2SiO4Y8+Akw9vs052AyKw0s5nhbYHCZE2IMQdHNjKwxEGAQ== dL7lO8sqFFCOXJO/u8SgoDk2nlXGWPRDbOTJkChMbmtUp9PB7sG831basXkZ/0CQ/l/vG7AbPyMNEVZyJn5NCg==

View file

@ -1,4 +1,4 @@
untrusted comment: One more (untrusted) comment untrusted comment: One more (untrusted) comment
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0= RWQkliYstQBOKNoyq2O98hPmeVJQ6ShQLM58+4n0gkY0y0trFMDAsHuN/l4IyHfh8dDQ1ry0+IuZVrf/i8M/P3YFzFfAymDYCQ0=
trusted comment: Here's a trusted comment trusted comment: Here's a trusted comment
3CnkIuz9MEDa7uNyGZAbKZhuirwfiqm7E1uQHrd2SiO4Y8+Akw9vs052AyKw0s5nhbYHCZE2IMQdHNjKwxEGAQ== dL7lO8sqFFCOXJO/u8SgoDk2nlXGWPRDbOTJkChMbmtUp9PB7sG831basXkZ/0CQ/l/vG7AbPyMNEVZyJn5NCg==

View file

@ -1,2 +1,2 @@
untrusted comment: verify with ./signifykey.pub untrusted comment: verify with signifykey.pub
RWSKLNhZb0KdAbhRUhW2LQZXdnwttu2SYhM9EuC4mMgOJB85h7/YIPupf8/ldTs4N8e9Y/fhgdY40q5LQpt5IFC62fq0v8U1/w8= RWSKLNhZb0KdARbMcGN40hbHzKQYZDgDOFhEUT1YpzMnqre/mbKJ8td/HVlG03Am1YCszATiI0DbnljjTy4iNHYwqBfzrFUqUg0=

View file

@ -1,4 +0,0 @@
untrusted comment: signature from minisign secret key
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0=
trusted comment: timestamp:1605618622 file:vulnerabilities.json
osAPs4QPdDkmiWQxqeMIzYv/b+ZGxJ+19Sbrk1Cpq4t2gHBT+lqFtwL3OCzKWWyjGRTmHfsVGBYpzEdPRQ0/BQ==

View file

@ -1,4 +0,0 @@
untrusted comment: Here's a comment
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0=
trusted comment: Here's a trusted comment
3CnkIuz9MEDa7uNyGZAbKZhuirwfiqm7E1uQHrd2SiO4Y8+Akw9vs052AyKw0s5nhbYHCZE2IMQdHNjKwxEGAQ==

View file

@ -1,4 +0,0 @@
untrusted comment: One more (untrusted) comment
RWQkliYstQBOKFQFQTjmCd6TPw07VZyWFSB3v4+1BM1kv8eHLE5FDy2OkPEqtdaL53xftlrHoJQie0uCcovdlSV8kpyxiLrxEQ0=
trusted comment: Here's a trusted comment
3CnkIuz9MEDa7uNyGZAbKZhuirwfiqm7E1uQHrd2SiO4Y8+Akw9vs052AyKw0s5nhbYHCZE2IMQdHNjKwxEGAQ==

View file

@ -6,7 +6,7 @@
"description": "A mining flaw could cause miners to erroneously calculate PoW, due to an index overflow, if DAG size is exceeding the maximum 32 bit unsigned value.\n\nThis occurred on the ETC chain on 2020-11-06. This is likely to trigger for ETH mainnet around block `11550000`/epoch `385`, slated to occur early January 2021.\n\nThis issue is relevant only for miners, non-mining nodes are unaffected, since non-mining nodes use a smaller verification cache instead of a full DAG.", "description": "A mining flaw could cause miners to erroneously calculate PoW, due to an index overflow, if DAG size is exceeding the maximum 32 bit unsigned value.\n\nThis occurred on the ETC chain on 2020-11-06. This is likely to trigger for ETH mainnet around block `11550000`/epoch `385`, slated to occur early January 2021.\n\nThis issue is relevant only for miners, non-mining nodes are unaffected, since non-mining nodes use a smaller verification cache instead of a full DAG.",
"links": [ "links": [
"https://github.com/ethereum/go-ethereum/pull/21793", "https://github.com/ethereum/go-ethereum/pull/21793",
"https://blog.ethereum.org/2020/11/12/geth_security_release/", "https://blog.ethereum.org/2020/11/12/geth-security-release",
"https://github.com/ethereum/go-ethereum/commit/567d41d9363706b4b13ce0903804e8acf214af49", "https://github.com/ethereum/go-ethereum/commit/567d41d9363706b4b13ce0903804e8acf214af49",
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-v592-xf75-856p" "https://github.com/ethereum/go-ethereum/security/advisories/GHSA-v592-xf75-856p"
], ],
@ -23,7 +23,7 @@
"summary": "A denial-of-service issue can be used to crash Geth nodes during block processing, due to an underlying bug in Go (CVE-2020-28362) versions < `1.15.5`, or `<1.14.12`", "summary": "A denial-of-service issue can be used to crash Geth nodes during block processing, due to an underlying bug in Go (CVE-2020-28362) versions < `1.15.5`, or `<1.14.12`",
"description": "The DoS issue can be used to crash all Geth nodes during block processing, the effects of which would be that a major part of the Ethereum network went offline.\n\nOutside of Go-Ethereum, the issue is most likely relevant for all forks of Geth (such as TurboGeth or ETCs core-geth) which is built with versions of Go which contains the vulnerability.", "description": "The DoS issue can be used to crash all Geth nodes during block processing, the effects of which would be that a major part of the Ethereum network went offline.\n\nOutside of Go-Ethereum, the issue is most likely relevant for all forks of Geth (such as TurboGeth or ETCs core-geth) which is built with versions of Go which contains the vulnerability.",
"links": [ "links": [
"https://blog.ethereum.org/2020/11/12/geth_security_release/", "https://blog.ethereum.org/2020/11/12/geth-security-release",
"https://groups.google.com/g/golang-announce/c/NpBGTTmKzpM", "https://groups.google.com/g/golang-announce/c/NpBGTTmKzpM",
"https://github.com/golang/go/issues/42552", "https://github.com/golang/go/issues/42552",
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-m6gx-rhvj-fh52" "https://github.com/ethereum/go-ethereum/security/advisories/GHSA-m6gx-rhvj-fh52"
@ -41,7 +41,7 @@
"summary": "A consensus flaw in Geth, related to `datacopy` precompile", "summary": "A consensus flaw in Geth, related to `datacopy` precompile",
"description": "Geth erroneously performed a 'shallow' copy when the precompiled `datacopy` (at `0x00...04`) was invoked. An attacker could deploy a contract that uses the shallow copy to corrupt the contents of the `RETURNDATA`, thus causing a consensus failure.", "description": "Geth erroneously performed a 'shallow' copy when the precompiled `datacopy` (at `0x00...04`) was invoked. An attacker could deploy a contract that uses the shallow copy to corrupt the contents of the `RETURNDATA`, thus causing a consensus failure.",
"links": [ "links": [
"https://blog.ethereum.org/2020/11/12/geth_security_release/", "https://blog.ethereum.org/2020/11/12/geth-security-release",
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-69v6-xc2j-r2jf" "https://github.com/ethereum/go-ethereum/security/advisories/GHSA-69v6-xc2j-r2jf"
], ],
"introduced": "v1.9.7", "introduced": "v1.9.7",
@ -57,7 +57,7 @@
"summary": "A denial-of-service issue can be used to crash Geth nodes during block processing", "summary": "A denial-of-service issue can be used to crash Geth nodes during block processing",
"description": "Affected versions suffer from a vulnerability which can be exploited through the `MULMOD` operation, by specifying a modulo of `0`: `mulmod(a,b,0)`, causing a `panic` in the underlying library. \nThe crash was in the `uint256` library, where a buffer [underflowed](https://github.com/holiman/uint256/blob/4ce82e695c10ddad57215bdbeafb68b8c5df2c30/uint256.go#L442).\n\n\tif `d == 0`, `dLen` remains `0`\n\nand https://github.com/holiman/uint256/blob/4ce82e695c10ddad57215bdbeafb68b8c5df2c30/uint256.go#L451 will try to access index `[-1]`.\n\nThe `uint256` library was first merged in this [commit](https://github.com/ethereum/go-ethereum/commit/cf6674539c589f80031f3371a71c6a80addbe454), on 2020-06-08. \nExploiting this vulnerabilty would cause all vulnerable nodes to drop off the network. \n\nThe issue was brought to our attention through a [bug report](https://github.com/ethereum/go-ethereum/issues/21367), showing a `panic` occurring on sync from genesis on the Ropsten network.\n \nIt was estimated that the least obvious way to fix this would be to merge the fix into `uint256`, make a new release of that library and then update the geth-dependency.\n", "description": "Affected versions suffer from a vulnerability which can be exploited through the `MULMOD` operation, by specifying a modulo of `0`: `mulmod(a,b,0)`, causing a `panic` in the underlying library. \nThe crash was in the `uint256` library, where a buffer [underflowed](https://github.com/holiman/uint256/blob/4ce82e695c10ddad57215bdbeafb68b8c5df2c30/uint256.go#L442).\n\n\tif `d == 0`, `dLen` remains `0`\n\nand https://github.com/holiman/uint256/blob/4ce82e695c10ddad57215bdbeafb68b8c5df2c30/uint256.go#L451 will try to access index `[-1]`.\n\nThe `uint256` library was first merged in this [commit](https://github.com/ethereum/go-ethereum/commit/cf6674539c589f80031f3371a71c6a80addbe454), on 2020-06-08. \nExploiting this vulnerabilty would cause all vulnerable nodes to drop off the network. \n\nThe issue was brought to our attention through a [bug report](https://github.com/ethereum/go-ethereum/issues/21367), showing a `panic` occurring on sync from genesis on the Ropsten network.\n \nIt was estimated that the least obvious way to fix this would be to merge the fix into `uint256`, make a new release of that library and then update the geth-dependency.\n",
"links": [ "links": [
"https://blog.ethereum.org/2020/11/12/geth_security_release/", "https://blog.ethereum.org/2020/11/12/geth-security-release",
"https://github.com/ethereum/go-ethereum/security/advisories/GHSA-jm5c-rv3w-w83m", "https://github.com/ethereum/go-ethereum/security/advisories/GHSA-jm5c-rv3w-w83m",
"https://github.com/holiman/uint256/releases/tag/v1.1.1", "https://github.com/holiman/uint256/releases/tag/v1.1.1",
"https://github.com/holiman/uint256/pull/80", "https://github.com/holiman/uint256/pull/80",

View file

@ -36,6 +36,9 @@ func TestVerification(t *testing.T) {
t.Parallel() t.Parallel()
// For this test, the pubkey is in testdata/vcheck/minisign.pub // For this test, the pubkey is in testdata/vcheck/minisign.pub
// (the privkey is `minisign.sec`, if we want to expand this test. Password 'test' ) // (the privkey is `minisign.sec`, if we want to expand this test. Password 'test' )
// 1. `minisign -S -l -s ./minisign.sec -m data.json -x ./minisig-sigs/vulnerabilities.json.minisig.1 -c "signature from minisign secret key"`
// 2. `minisign -S -l -s ./minisign.sec -m vulnerabilities.json -x ./minisig-sigs/vulnerabilities.json.minisig.2 -c "Here's a comment" -t "Here's a trusted comment"`
// 3. minisign -S -l -s ./minisign.sec -m vulnerabilities.json -x ./minisig-sigs/vulnerabilities.json.minisig.3 -c "One more (untrusted™) comment" -t "Here's a trusted comment"
pub := "RWQkliYstQBOKOdtClfgC3IypIPX6TAmoEi7beZ4gyR3wsaezvqOMWsp" pub := "RWQkliYstQBOKOdtClfgC3IypIPX6TAmoEi7beZ4gyR3wsaezvqOMWsp"
testVerification(t, pub, "./testdata/vcheck/minisig-sigs/") testVerification(t, pub, "./testdata/vcheck/minisig-sigs/")
}) })
@ -43,7 +46,7 @@ func TestVerification(t *testing.T) {
t.Parallel() t.Parallel()
// For this test, the pubkey is in testdata/vcheck/minisign.pub // For this test, the pubkey is in testdata/vcheck/minisign.pub
// (the privkey is `minisign.sec`, if we want to expand this test. Password 'test' ) // (the privkey is `minisign.sec`, if we want to expand this test. Password 'test' )
// `minisign -S -s ./minisign.sec -m data.json -x ./minisig-sigs-new/data.json.minisig` // `minisign -S -s ./minisign.sec -m data.json -x ./minisig-sigs-new/data.json.minisig`
pub := "RWQkliYstQBOKOdtClfgC3IypIPX6TAmoEi7beZ4gyR3wsaezvqOMWsp" pub := "RWQkliYstQBOKOdtClfgC3IypIPX6TAmoEi7beZ4gyR3wsaezvqOMWsp"
testVerification(t, pub, "./testdata/vcheck/minisig-sigs-new/") testVerification(t, pub, "./testdata/vcheck/minisig-sigs-new/")
}) })
@ -53,6 +56,7 @@ func TestVerification(t *testing.T) {
t.Skip("This currently fails, minisign expects 4 lines of data, signify provides only 2") t.Skip("This currently fails, minisign expects 4 lines of data, signify provides only 2")
// For this test, the pubkey is in testdata/vcheck/signifykey.pub // For this test, the pubkey is in testdata/vcheck/signifykey.pub
// (the privkey is `signifykey.sec`, if we want to expand this test. Password 'test' ) // (the privkey is `signifykey.sec`, if we want to expand this test. Password 'test' )
// `signify -S -s signifykey.sec -m data.json -x ./signify-sigs/data.json.sig`
pub := "RWSKLNhZb0KdATtRT7mZC/bybI3t3+Hv/O2i3ye04Dq9fnT9slpZ1a2/" pub := "RWSKLNhZb0KdATtRT7mZC/bybI3t3+Hv/O2i3ye04Dq9fnT9slpZ1a2/"
testVerification(t, pub, "./testdata/vcheck/signify-sigs/") testVerification(t, pub, "./testdata/vcheck/signify-sigs/")
}) })

View file

@ -49,10 +49,10 @@ import (
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/kzg4844" "github.com/ethereum/go-ethereum/crypto/kzg4844"
"github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/catalyst"
"github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/eth/gasprice" "github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/eth/syncer"
"github.com/ethereum/go-ethereum/eth/tracers" "github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb/remotedb" "github.com/ethereum/go-ethereum/ethdb/remotedb"
@ -261,7 +261,7 @@ var (
} }
GCModeFlag = &cli.StringFlag{ GCModeFlag = &cli.StringFlag{
Name: "gcmode", Name: "gcmode",
Usage: `Blockchain garbage collection mode, only relevant in state.scheme=hash ("full", "archive")`, Usage: `Blockchain garbage collection mode ("full", "archive")`,
Value: "full", Value: "full",
Category: flags.StateCategory, Category: flags.StateCategory,
} }
@ -1379,13 +1379,13 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
cfg.UseLightweightKDF = ctx.Bool(LightKDFFlag.Name) cfg.UseLightweightKDF = ctx.Bool(LightKDFFlag.Name)
} }
if ctx.IsSet(NoUSBFlag.Name) || cfg.NoUSB { if ctx.IsSet(NoUSBFlag.Name) || cfg.NoUSB {
log.Warn("Option nousb is deprecated and USB is deactivated by default. Use --usb to enable") log.Warn("Option --nousb is deprecated and USB is deactivated by default. Use --usb to enable")
} }
if ctx.IsSet(USBFlag.Name) { if ctx.IsSet(USBFlag.Name) {
cfg.USB = ctx.Bool(USBFlag.Name) cfg.USB = ctx.Bool(USBFlag.Name)
} }
if ctx.IsSet(InsecureUnlockAllowedFlag.Name) { if ctx.IsSet(InsecureUnlockAllowedFlag.Name) {
log.Warn(fmt.Sprintf("Option %q is deprecated and has no effect", InsecureUnlockAllowedFlag.Name)) log.Warn(fmt.Sprintf("Option --%s is deprecated and has no effect", InsecureUnlockAllowedFlag.Name))
} }
if ctx.IsSet(DBEngineFlag.Name) { if ctx.IsSet(DBEngineFlag.Name) {
dbEngine := ctx.String(DBEngineFlag.Name) dbEngine := ctx.String(DBEngineFlag.Name)
@ -1397,10 +1397,10 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
} }
// deprecation notice for log debug flags (TODO: find a more appropriate place to put these?) // deprecation notice for log debug flags (TODO: find a more appropriate place to put these?)
if ctx.IsSet(LogBacktraceAtFlag.Name) { if ctx.IsSet(LogBacktraceAtFlag.Name) {
log.Warn("log.backtrace flag is deprecated") log.Warn("Option --log.backtrace flag is deprecated")
} }
if ctx.IsSet(LogDebugFlag.Name) { if ctx.IsSet(LogDebugFlag.Name) {
log.Warn("log.debug flag is deprecated") log.Warn("Option --log.debug flag is deprecated")
} }
} }
@ -1859,7 +1859,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
func MakeBeaconLightConfig(ctx *cli.Context) bparams.ClientConfig { func MakeBeaconLightConfig(ctx *cli.Context) bparams.ClientConfig {
var config bparams.ClientConfig var config bparams.ClientConfig
customConfig := ctx.IsSet(BeaconConfigFlag.Name) customConfig := ctx.IsSet(BeaconConfigFlag.Name)
flags.CheckExclusive(ctx, MainnetFlag, SepoliaFlag, HoleskyFlag, BeaconConfigFlag) flags.CheckExclusive(ctx, MainnetFlag, SepoliaFlag, HoleskyFlag, HoodiFlag, BeaconConfigFlag)
switch { switch {
case ctx.Bool(MainnetFlag.Name): case ctx.Bool(MainnetFlag.Name):
config.ChainConfig = *bparams.MainnetLightConfig config.ChainConfig = *bparams.MainnetLightConfig
@ -1997,10 +1997,14 @@ func RegisterFilterAPI(stack *node.Node, backend ethapi.Backend, ethcfg *ethconf
return filterSystem return filterSystem
} }
// RegisterFullSyncTester adds the full-sync tester service into node. // RegisterSyncOverrideService adds the synchronization override service into node.
func RegisterFullSyncTester(stack *node.Node, eth *eth.Ethereum, target common.Hash) { func RegisterSyncOverrideService(stack *node.Node, eth *eth.Ethereum, target common.Hash, exitWhenSynced bool) {
catalyst.RegisterFullSyncTester(stack, eth, target) if target != (common.Hash{}) {
log.Info("Registered full-sync tester", "hash", target) log.Info("Registered sync override service", "hash", target, "exitWhenSynced", exitWhenSynced)
} else {
log.Info("Registered sync override service")
}
syncer.Register(stack, eth, target, exitWhenSynced)
} }
// SetupMetrics configures the metrics system. // SetupMetrics configures the metrics system.
@ -2198,6 +2202,12 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
StateHistory: ctx.Uint64(StateHistoryFlag.Name), StateHistory: ctx.Uint64(StateHistoryFlag.Name),
// Disable transaction indexing/unindexing. // Disable transaction indexing/unindexing.
TxLookupLimit: -1, TxLookupLimit: -1,
// Enables file journaling for the trie database. The journal files will be stored
// within the data directory. The corresponding paths will be either:
// - DATADIR/triedb/merkle.journal
// - DATADIR/triedb/verkle.journal
TrieJournalDirectory: stack.ResolvePath("triedb"),
} }
if options.ArchiveMode && !options.Preimages { if options.ArchiveMode && !options.Preimages {
options.Preimages = true options.Preimages = true

View file

@ -44,40 +44,50 @@ var DeprecatedFlags = []cli.Flag{
MinerNewPayloadTimeoutFlag, MinerNewPayloadTimeoutFlag,
MinerEtherbaseFlag, MinerEtherbaseFlag,
MiningEnabledFlag, MiningEnabledFlag,
MetricsEnabledExpensiveFlag,
EnablePersonal,
UnlockedAccountFlag,
InsecureUnlockAllowedFlag,
} }
var ( var (
// Deprecated May 2020, shown in aliased flags section // Deprecated May 2020, shown in aliased flags section
NoUSBFlag = &cli.BoolFlag{ NoUSBFlag = &cli.BoolFlag{
Name: "nousb", Name: "nousb",
Hidden: true,
Usage: "Disables monitoring for and managing USB hardware wallets (deprecated)", Usage: "Disables monitoring for and managing USB hardware wallets (deprecated)",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
// Deprecated March 2022 // Deprecated March 2022
LegacyWhitelistFlag = &cli.StringFlag{ LegacyWhitelistFlag = &cli.StringFlag{
Name: "whitelist", Name: "whitelist",
Hidden: true,
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>) (deprecated in favor of --eth.requiredblocks)", Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>) (deprecated in favor of --eth.requiredblocks)",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
// Deprecated July 2023 // Deprecated July 2023
CacheTrieJournalFlag = &cli.StringFlag{ CacheTrieJournalFlag = &cli.StringFlag{
Name: "cache.trie.journal", Name: "cache.trie.journal",
Hidden: true,
Usage: "Disk journal directory for trie cache to survive node restarts", Usage: "Disk journal directory for trie cache to survive node restarts",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
CacheTrieRejournalFlag = &cli.DurationFlag{ CacheTrieRejournalFlag = &cli.DurationFlag{
Name: "cache.trie.rejournal", Name: "cache.trie.rejournal",
Hidden: true,
Usage: "Time interval to regenerate the trie cache journal", Usage: "Time interval to regenerate the trie cache journal",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
LegacyDiscoveryV5Flag = &cli.BoolFlag{ LegacyDiscoveryV5Flag = &cli.BoolFlag{
Name: "v5disc", Name: "v5disc",
Hidden: true,
Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism (deprecated, use --discv5 instead)", Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism (deprecated, use --discv5 instead)",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
// Deprecated August 2023 // Deprecated August 2023
TxLookupLimitFlag = &cli.Uint64Flag{ TxLookupLimitFlag = &cli.Uint64Flag{
Name: "txlookuplimit", Name: "txlookuplimit",
Hidden: true,
Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (deprecated, use history.transactions instead)", Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (deprecated, use history.transactions instead)",
Value: ethconfig.Defaults.TransactionHistory, Value: ethconfig.Defaults.TransactionHistory,
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
@ -85,51 +95,60 @@ var (
// Deprecated November 2023 // Deprecated November 2023
LogBacktraceAtFlag = &cli.StringFlag{ LogBacktraceAtFlag = &cli.StringFlag{
Name: "log.backtrace", Name: "log.backtrace",
Hidden: true,
Usage: "Request a stack trace at a specific logging statement (deprecated)", Usage: "Request a stack trace at a specific logging statement (deprecated)",
Value: "", Value: "",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
LogDebugFlag = &cli.BoolFlag{ LogDebugFlag = &cli.BoolFlag{
Name: "log.debug", Name: "log.debug",
Hidden: true,
Usage: "Prepends log messages with call-site location (deprecated)", Usage: "Prepends log messages with call-site location (deprecated)",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
// Deprecated February 2024 // Deprecated February 2024
MinerNewPayloadTimeoutFlag = &cli.DurationFlag{ MinerNewPayloadTimeoutFlag = &cli.DurationFlag{
Name: "miner.newpayload-timeout", Name: "miner.newpayload-timeout",
Hidden: true,
Usage: "Specify the maximum time allowance for creating a new payload (deprecated)", Usage: "Specify the maximum time allowance for creating a new payload (deprecated)",
Value: ethconfig.Defaults.Miner.Recommit, Value: ethconfig.Defaults.Miner.Recommit,
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
MinerEtherbaseFlag = &cli.StringFlag{ MinerEtherbaseFlag = &cli.StringFlag{
Name: "miner.etherbase", Name: "miner.etherbase",
Hidden: true,
Usage: "0x prefixed public address for block mining rewards (deprecated)", Usage: "0x prefixed public address for block mining rewards (deprecated)",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
MiningEnabledFlag = &cli.BoolFlag{ MiningEnabledFlag = &cli.BoolFlag{
Name: "mine", Name: "mine",
Hidden: true,
Usage: "Enable mining (deprecated)", Usage: "Enable mining (deprecated)",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
MetricsEnabledExpensiveFlag = &cli.BoolFlag{ MetricsEnabledExpensiveFlag = &cli.BoolFlag{
Name: "metrics.expensive", Name: "metrics.expensive",
Hidden: true,
Usage: "Enable expensive metrics collection and reporting (deprecated)", Usage: "Enable expensive metrics collection and reporting (deprecated)",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
// Deprecated Oct 2024 // Deprecated Oct 2024
EnablePersonal = &cli.BoolFlag{ EnablePersonal = &cli.BoolFlag{
Name: "rpc.enabledeprecatedpersonal", Name: "rpc.enabledeprecatedpersonal",
Hidden: true,
Usage: "This used to enable the 'personal' namespace.", Usage: "This used to enable the 'personal' namespace.",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
UnlockedAccountFlag = &cli.StringFlag{ UnlockedAccountFlag = &cli.StringFlag{
Name: "unlock", Name: "unlock",
Hidden: true,
Usage: "Comma separated list of accounts to unlock (deprecated)", Usage: "Comma separated list of accounts to unlock (deprecated)",
Value: "", Value: "",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }
InsecureUnlockAllowedFlag = &cli.BoolFlag{ InsecureUnlockAllowedFlag = &cli.BoolFlag{
Name: "allow-insecure-unlock", Name: "allow-insecure-unlock",
Hidden: true,
Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http (deprecated)", Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http (deprecated)",
Category: flags.DeprecatedCategory, Category: flags.DeprecatedCategory,
} }

View file

@ -17,6 +17,13 @@ and `eth_getBlockByNumber`, use this command:
> ./workload test --sepolia --run History/getBlockBy http://host:8545 > ./workload test --sepolia --run History/getBlockBy http://host:8545
``` ```
Notably, trace tests require archive which keeps all the historical states for tracing.
The additional flag is required to activate the trace tests.
```
> ./workload test --sepolia --archive --run Trace/Block http://host:8545
```
### Regenerating tests ### Regenerating tests
There is a facility for updating the tests from the chain. This can also be used to There is a facility for updating the tests from the chain. This can also be used to
@ -26,5 +33,5 @@ the following commands (in this directory) against a synced mainnet node:
```shell ```shell
> go run . filtergen --queries queries/filter_queries_mainnet.json http://host:8545 > go run . filtergen --queries queries/filter_queries_mainnet.json http://host:8545
> go run . historygen --history-tests queries/history_mainnet.json http://host:8545 > go run . historygen --history-tests queries/history_mainnet.json http://host:8545
> go run . tracegen --trace-tests queries/trace_mainnet.json http://host:8545 > go run . tracegen --trace-tests queries/trace_mainnet.json --trace-start 4000000 --trace-end 4000100 http://host:8545
``` ```

View file

@ -21,6 +21,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"math/big" "math/big"
"os"
"time" "time"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
@ -153,7 +154,14 @@ func (s *filterTestSuite) fullRangeQueryAndCheck(t *utesting.T, query *filterQue
func (s *filterTestSuite) loadQueries() error { func (s *filterTestSuite) loadQueries() error {
file, err := s.cfg.fsys.Open(s.cfg.filterQueryFile) file, err := s.cfg.fsys.Open(s.cfg.filterQueryFile)
if err != nil { if err != nil {
return fmt.Errorf("can't open filterQueryFile: %v", err) // If not found in embedded FS, try to load it from disk
if !os.IsNotExist(err) {
return err
}
file, err = os.OpenFile(s.cfg.filterQueryFile, os.O_RDONLY, 0666)
if err != nil {
return fmt.Errorf("can't open filterQueryFile: %v", err)
}
} }
defer file.Close() defer file.Close()

View file

@ -20,6 +20,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"os"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
@ -52,7 +53,14 @@ func newHistoryTestSuite(cfg testConfig) *historyTestSuite {
func (s *historyTestSuite) loadTests() error { func (s *historyTestSuite) loadTests() error {
file, err := s.cfg.fsys.Open(s.cfg.historyTestFile) file, err := s.cfg.fsys.Open(s.cfg.historyTestFile)
if err != nil { if err != nil {
return fmt.Errorf("can't open historyTestFile: %v", err) // If not found in embedded FS, try to load it from disk
if !os.IsNotExist(err) {
return err
}
file, err = os.OpenFile(s.cfg.historyTestFile, os.O_RDONLY, 0666)
if err != nil {
return fmt.Errorf("can't open historyTestFile: %v", err)
}
} }
defer file.Close() defer file.Close()
if err := json.NewDecoder(file).Decode(&s.tests); err != nil { if err := json.NewDecoder(file).Decode(&s.tests); err != nil {

View file

@ -22,6 +22,7 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"os" "os"
"path/filepath"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
@ -137,11 +138,17 @@ func calcReceiptsHash(rcpt []*types.Receipt) common.Hash {
} }
func writeJSON(fileName string, value any) { func writeJSON(fileName string, value any) {
// Ensure the directory exists
dir := filepath.Dir(fileName)
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
exit(fmt.Errorf("failed to create directories: %w", err))
}
file, err := os.Create(fileName) file, err := os.Create(fileName)
if err != nil { if err != nil {
exit(fmt.Errorf("error creating %s: %v", fileName, err)) exit(fmt.Errorf("error creating %s: %v", fileName, err))
return return
} }
defer file.Close() defer file.Close()
json.NewEncoder(file).Encode(value) json.NewEncoder(file).Encode(value)
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -18,7 +18,7 @@ package main
import ( import (
"embed" "embed"
"fmt" "errors"
"io/fs" "io/fs"
"os" "os"
@ -97,7 +97,7 @@ type testConfig struct {
traceTestFile string traceTestFile string
} }
var errPrunedHistory = fmt.Errorf("attempt to access pruned history") var errPrunedHistory = errors.New("attempt to access pruned history")
// validateHistoryPruneErr checks whether the given error is caused by access // validateHistoryPruneErr checks whether the given error is caused by access
// to history before the pruning threshold block (it is an rpc.Error with code 4444). // to history before the pruning threshold block (it is an rpc.Error with code 4444).
@ -109,7 +109,7 @@ func validateHistoryPruneErr(err error, blockNum uint64, historyPruneBlock *uint
if err != nil { if err != nil {
if rpcErr, ok := err.(rpc.Error); ok && rpcErr.ErrorCode() == 4444 { if rpcErr, ok := err.(rpc.Error); ok && rpcErr.ErrorCode() == 4444 {
if historyPruneBlock != nil && blockNum > *historyPruneBlock { if historyPruneBlock != nil && blockNum > *historyPruneBlock {
return fmt.Errorf("pruned history error returned after pruning threshold") return errors.New("pruned history error returned after pruning threshold")
} }
return errPrunedHistory return errPrunedHistory
} }
@ -130,18 +130,42 @@ func testConfigFromCLI(ctx *cli.Context) (cfg testConfig) {
switch { switch {
case ctx.Bool(testMainnetFlag.Name): case ctx.Bool(testMainnetFlag.Name):
cfg.fsys = builtinTestFiles cfg.fsys = builtinTestFiles
cfg.filterQueryFile = "queries/filter_queries_mainnet.json" if ctx.IsSet(filterQueryFileFlag.Name) {
cfg.historyTestFile = "queries/history_mainnet.json" cfg.filterQueryFile = ctx.String(filterQueryFileFlag.Name)
} else {
cfg.filterQueryFile = "queries/filter_queries_mainnet.json"
}
if ctx.IsSet(historyTestFileFlag.Name) {
cfg.historyTestFile = ctx.String(historyTestFileFlag.Name)
} else {
cfg.historyTestFile = "queries/history_mainnet.json"
}
if ctx.IsSet(traceTestFileFlag.Name) {
cfg.traceTestFile = ctx.String(traceTestFileFlag.Name)
} else {
cfg.traceTestFile = "queries/trace_mainnet.json"
}
cfg.historyPruneBlock = new(uint64) cfg.historyPruneBlock = new(uint64)
*cfg.historyPruneBlock = history.PrunePoints[params.MainnetGenesisHash].BlockNumber *cfg.historyPruneBlock = history.PrunePoints[params.MainnetGenesisHash].BlockNumber
cfg.traceTestFile = "queries/trace_mainnet.json"
case ctx.Bool(testSepoliaFlag.Name): case ctx.Bool(testSepoliaFlag.Name):
cfg.fsys = builtinTestFiles cfg.fsys = builtinTestFiles
cfg.filterQueryFile = "queries/filter_queries_sepolia.json" if ctx.IsSet(filterQueryFileFlag.Name) {
cfg.historyTestFile = "queries/history_sepolia.json" cfg.filterQueryFile = ctx.String(filterQueryFileFlag.Name)
} else {
cfg.filterQueryFile = "queries/filter_queries_sepolia.json"
}
if ctx.IsSet(historyTestFileFlag.Name) {
cfg.historyTestFile = ctx.String(historyTestFileFlag.Name)
} else {
cfg.historyTestFile = "queries/history_sepolia.json"
}
if ctx.IsSet(traceTestFileFlag.Name) {
cfg.traceTestFile = ctx.String(traceTestFileFlag.Name)
} else {
cfg.traceTestFile = "queries/trace_sepolia.json"
}
cfg.historyPruneBlock = new(uint64) cfg.historyPruneBlock = new(uint64)
*cfg.historyPruneBlock = history.PrunePoints[params.SepoliaGenesisHash].BlockNumber *cfg.historyPruneBlock = history.PrunePoints[params.SepoliaGenesisHash].BlockNumber
cfg.traceTestFile = "queries/trace_sepolia.json"
default: default:
cfg.fsys = os.DirFS(".") cfg.fsys = os.DirFS(".")
cfg.filterQueryFile = ctx.String(filterQueryFileFlag.Name) cfg.filterQueryFile = ctx.String(filterQueryFileFlag.Name)

View file

@ -33,7 +33,7 @@ import (
// traceTest is the content of a history test. // traceTest is the content of a history test.
type traceTest struct { type traceTest struct {
TxHashes []common.Hash `json:"txHashes"` BlockHashes []common.Hash `json:"blockHashes"`
TraceConfigs []tracers.TraceConfig `json:"traceConfigs"` TraceConfigs []tracers.TraceConfig `json:"traceConfigs"`
ResultHashes []common.Hash `json:"resultHashes"` ResultHashes []common.Hash `json:"resultHashes"`
} }
@ -58,14 +58,20 @@ func newTraceTestSuite(cfg testConfig, ctx *cli.Context) *traceTestSuite {
func (s *traceTestSuite) loadTests() error { func (s *traceTestSuite) loadTests() error {
file, err := s.cfg.fsys.Open(s.cfg.traceTestFile) file, err := s.cfg.fsys.Open(s.cfg.traceTestFile)
if err != nil { if err != nil {
return fmt.Errorf("can't open traceTestFile: %v", err) // If not found in embedded FS, try to load it from disk
if !os.IsNotExist(err) {
return err
}
file, err = os.OpenFile(s.cfg.traceTestFile, os.O_RDONLY, 0666)
if err != nil {
return fmt.Errorf("can't open traceTestFile: %v", err)
}
} }
defer file.Close() defer file.Close()
if err := json.NewDecoder(file).Decode(&s.tests); err != nil { if err := json.NewDecoder(file).Decode(&s.tests); err != nil {
return fmt.Errorf("invalid JSON in %s: %v", s.cfg.traceTestFile, err) return fmt.Errorf("invalid JSON in %s: %v", s.cfg.traceTestFile, err)
} }
if len(s.tests.TxHashes) == 0 { if len(s.tests.BlockHashes) == 0 {
return fmt.Errorf("traceTestFile %s has no test data", s.cfg.traceTestFile) return fmt.Errorf("traceTestFile %s has no test data", s.cfg.traceTestFile)
} }
return nil return nil
@ -73,17 +79,17 @@ func (s *traceTestSuite) loadTests() error {
func (s *traceTestSuite) allTests() []workloadTest { func (s *traceTestSuite) allTests() []workloadTest {
return []workloadTest{ return []workloadTest{
newArchiveWorkloadTest("Trace/Transaction", s.traceTransaction), newArchiveWorkloadTest("Trace/Block", s.traceBlock),
} }
} }
// traceTransaction runs all transaction tracing tests // traceBlock runs all block tracing tests
func (s *traceTestSuite) traceTransaction(t *utesting.T) { func (s *traceTestSuite) traceBlock(t *utesting.T) {
ctx := context.Background() ctx := context.Background()
for i, hash := range s.tests.TxHashes { for i, hash := range s.tests.BlockHashes {
config := s.tests.TraceConfigs[i] config := s.tests.TraceConfigs[i]
result, err := s.cfg.client.Geth.TraceTransaction(ctx, hash, &config) result, err := s.cfg.client.Geth.TraceBlock(ctx, hash, &config)
if err != nil { if err != nil {
t.Fatalf("Transaction %d (hash %v): error %v", i, hash, err) t.Fatalf("Transaction %d (hash %v): error %v", i, hash, err)
} }

View file

@ -36,8 +36,6 @@ import (
) )
var ( var (
defaultBlocksToTrace = 64 // the number of states assumed to be available
traceGenerateCommand = &cli.Command{ traceGenerateCommand = &cli.Command{
Name: "tracegen", Name: "tracegen",
Usage: "Generates tests for state tracing", Usage: "Generates tests for state tracing",
@ -46,7 +44,8 @@ var (
Flags: []cli.Flag{ Flags: []cli.Flag{
traceTestFileFlag, traceTestFileFlag,
traceTestResultOutputFlag, traceTestResultOutputFlag,
traceTestBlockFlag, traceTestStartBlockFlag,
traceTestEndBlockFlag,
}, },
} }
@ -58,14 +57,18 @@ var (
} }
traceTestResultOutputFlag = &cli.StringFlag{ traceTestResultOutputFlag = &cli.StringFlag{
Name: "trace-output", Name: "trace-output",
Usage: "Folder containing the trace output files", Usage: "Folder containing detailed trace output files",
Value: "", Value: "",
Category: flags.TestingCategory, Category: flags.TestingCategory,
} }
traceTestBlockFlag = &cli.IntFlag{ traceTestStartBlockFlag = &cli.IntFlag{
Name: "trace-blocks", Name: "trace-start",
Usage: "The number of blocks for tracing", Usage: "The number of starting block for tracing (included)",
Value: defaultBlocksToTrace, Category: flags.TestingCategory,
}
traceTestEndBlockFlag = &cli.IntFlag{
Name: "trace-end",
Usage: "The number of ending block for tracing (excluded)",
Category: flags.TestingCategory, Category: flags.TestingCategory,
} }
traceTestInvalidOutputFlag = &cli.StringFlag{ traceTestInvalidOutputFlag = &cli.StringFlag{
@ -81,21 +84,22 @@ func generateTraceTests(clictx *cli.Context) error {
client = makeClient(clictx) client = makeClient(clictx)
outputFile = clictx.String(traceTestFileFlag.Name) outputFile = clictx.String(traceTestFileFlag.Name)
outputDir = clictx.String(traceTestResultOutputFlag.Name) outputDir = clictx.String(traceTestResultOutputFlag.Name)
blocks = clictx.Int(traceTestBlockFlag.Name) startBlock = clictx.Int(traceTestStartBlockFlag.Name)
endBlock = clictx.Int(traceTestEndBlockFlag.Name)
ctx = context.Background() ctx = context.Background()
test = new(traceTest) test = new(traceTest)
) )
if outputDir != "" {
err := os.MkdirAll(outputDir, os.ModePerm)
if err != nil {
return err
}
}
latest, err := client.Eth.BlockNumber(ctx) latest, err := client.Eth.BlockNumber(ctx)
if err != nil { if err != nil {
exit(err) exit(err)
} }
if latest < uint64(blocks) { if startBlock > endBlock {
exit(fmt.Errorf("invalid block range for tracing, start: %d, end: %d", startBlock, endBlock))
}
if endBlock-startBlock == 0 {
exit(fmt.Errorf("invalid block range for tracing, start: %d, end: %d", startBlock, endBlock))
}
if latest < uint64(startBlock) || latest < uint64(endBlock) {
exit(fmt.Errorf("node seems not synced, latest block is %d", latest)) exit(fmt.Errorf("node seems not synced, latest block is %d", latest))
} }
// Get blocks and assign block info into the test // Get blocks and assign block info into the test
@ -104,37 +108,35 @@ func generateTraceTests(clictx *cli.Context) error {
logged = time.Now() logged = time.Now()
failed int failed int
) )
log.Info("Trace transactions around the chain tip", "head", latest, "blocks", blocks) log.Info("Trace transactions around the chain tip", "head", latest, "start", startBlock, "end", endBlock)
for i := 0; i < blocks; i++ { for i := startBlock; i < endBlock; i++ {
number := latest - uint64(i) header, err := client.Eth.HeaderByNumber(ctx, big.NewInt(int64(i)))
block, err := client.Eth.BlockByNumber(ctx, big.NewInt(int64(number)))
if err != nil { if err != nil {
exit(err) exit(err)
} }
for _, tx := range block.Transactions() { config, configName := randomTraceOption()
config, configName := randomTraceOption() result, err := client.Geth.TraceBlock(ctx, header.Hash(), config)
result, err := client.Geth.TraceTransaction(ctx, tx.Hash(), config) if err != nil {
if err != nil { failed += 1
failed += 1 continue
break
}
blob, err := json.Marshal(result)
if err != nil {
failed += 1
break
}
test.TxHashes = append(test.TxHashes, tx.Hash())
test.TraceConfigs = append(test.TraceConfigs, *config)
test.ResultHashes = append(test.ResultHashes, crypto.Keccak256Hash(blob))
writeTraceResult(outputDir, tx.Hash(), result, configName)
} }
blob, err := json.Marshal(result)
if err != nil {
failed += 1
continue
}
test.BlockHashes = append(test.BlockHashes, header.Hash())
test.TraceConfigs = append(test.TraceConfigs, *config)
test.ResultHashes = append(test.ResultHashes, crypto.Keccak256Hash(blob))
writeTraceResult(outputDir, header.Hash(), result, configName)
if time.Since(logged) > time.Second*8 { if time.Since(logged) > time.Second*8 {
logged = time.Now() logged = time.Now()
log.Info("Tracing transactions", "executed", len(test.TxHashes), "failed", failed, "elapsed", common.PrettyDuration(time.Since(start))) log.Info("Tracing blocks", "executed", len(test.BlockHashes), "failed", failed, "elapsed", common.PrettyDuration(time.Since(start)))
} }
} }
log.Info("Traced transactions", "executed", len(test.TxHashes), "failed", failed, "elapsed", common.PrettyDuration(time.Since(start))) log.Info("Traced blocks", "executed", len(test.BlockHashes), "failed", failed, "elapsed", common.PrettyDuration(time.Since(start)))
// Write output file. // Write output file.
writeJSON(outputFile, test) writeJSON(outputFile, test)
@ -142,24 +144,15 @@ func generateTraceTests(clictx *cli.Context) error {
} }
func randomTraceOption() (*tracers.TraceConfig, string) { func randomTraceOption() (*tracers.TraceConfig, string) {
x := rand.Intn(11) x := rand.Intn(10)
if x == 0 { if x == 0 {
// struct-logger, with all fields enabled, very heavy
return &tracers.TraceConfig{
Config: &logger.Config{
EnableMemory: true,
EnableReturnData: true,
},
}, "structAll"
}
if x == 1 {
// default options for struct-logger, with stack and storage capture // default options for struct-logger, with stack and storage capture
// enabled // enabled
return &tracers.TraceConfig{ return &tracers.TraceConfig{
Config: &logger.Config{}, Config: &logger.Config{},
}, "structDefault" }, "structDefault"
} }
if x == 2 || x == 3 || x == 4 { if x >= 1 && x <= 3 {
// struct-logger with storage capture enabled // struct-logger with storage capture enabled
return &tracers.TraceConfig{ return &tracers.TraceConfig{
Config: &logger.Config{ Config: &logger.Config{
@ -170,14 +163,18 @@ func randomTraceOption() (*tracers.TraceConfig, string) {
// Native tracer // Native tracer
loggers := []string{"callTracer", "4byteTracer", "flatCallTracer", "muxTracer", "noopTracer", "prestateTracer"} loggers := []string{"callTracer", "4byteTracer", "flatCallTracer", "muxTracer", "noopTracer", "prestateTracer"}
return &tracers.TraceConfig{ return &tracers.TraceConfig{
Tracer: &loggers[x-5], Tracer: &loggers[x-4],
}, loggers[x-5] }, loggers[x-4]
} }
func writeTraceResult(dir string, hash common.Hash, result any, configName string) { func writeTraceResult(dir string, hash common.Hash, result any, configName string) {
if dir == "" { if dir == "" {
return return
} }
// Ensure the directory exists
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
exit(fmt.Errorf("failed to create directories: %w", err))
}
name := filepath.Join(dir, configName+"_"+hash.String()) name := filepath.Join(dir, configName+"_"+hash.String())
file, err := os.Create(name) file, err := os.Create(name)
if err != nil { if err != nil {

View file

@ -34,11 +34,10 @@ import (
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"math/big" "math/big"
"math/bits"
"strconv" "strconv"
) )
const uintBits = 32 << (uint64(^uint(0)) >> 63)
// Errors // Errors
var ( var (
ErrEmptyString = &decError{"empty hex string"} ErrEmptyString = &decError{"empty hex string"}
@ -48,7 +47,7 @@ var (
ErrEmptyNumber = &decError{"hex string \"0x\""} ErrEmptyNumber = &decError{"hex string \"0x\""}
ErrLeadingZero = &decError{"hex number with leading zero digits"} ErrLeadingZero = &decError{"hex number with leading zero digits"}
ErrUint64Range = &decError{"hex number > 64 bits"} ErrUint64Range = &decError{"hex number > 64 bits"}
ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", uintBits)} ErrUintRange = &decError{fmt.Sprintf("hex number > %d bits", bits.UintSize)}
ErrBig256Range = &decError{"hex number > 256 bits"} ErrBig256Range = &decError{"hex number > 256 bits"}
) )

View file

@ -22,6 +22,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"math/big" "math/big"
"math/bits"
"testing" "testing"
"github.com/holiman/uint256" "github.com/holiman/uint256"
@ -384,7 +385,7 @@ func TestUnmarshalUint(t *testing.T) {
for _, test := range unmarshalUintTests { for _, test := range unmarshalUintTests {
var v Uint var v Uint
err := json.Unmarshal([]byte(test.input), &v) err := json.Unmarshal([]byte(test.input), &v)
if uintBits == 32 && test.wantErr32bit != nil { if bits.UintSize == 32 && test.wantErr32bit != nil {
checkError(t, test.input, err, test.wantErr32bit) checkError(t, test.input, err, test.wantErr32bit)
continue continue
} }

View file

@ -23,7 +23,6 @@ import (
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params/forks"
) )
var ( var (
@ -71,52 +70,82 @@ func CalcExcessBlobGas(config *params.ChainConfig, parent *types.Header, headTim
parentExcessBlobGas = *parent.ExcessBlobGas parentExcessBlobGas = *parent.ExcessBlobGas
parentBlobGasUsed = *parent.BlobGasUsed parentBlobGasUsed = *parent.BlobGasUsed
} }
excessBlobGas := parentExcessBlobGas + parentBlobGasUsed var (
targetGas := uint64(targetBlobsPerBlock(config, headTimestamp)) * params.BlobTxBlobGasPerBlob excessBlobGas = parentExcessBlobGas + parentBlobGasUsed
target = targetBlobsPerBlock(config, headTimestamp)
targetGas = uint64(target) * params.BlobTxBlobGasPerBlob
)
if excessBlobGas < targetGas { if excessBlobGas < targetGas {
return 0 return 0
} }
if !config.IsOsaka(config.LondonBlock, headTimestamp) {
// Pre-Osaka, we use the formula defined by EIP-4844.
return excessBlobGas - targetGas
}
// EIP-7918 (post-Osaka) introduces a different formula for computing excess.
var (
baseCost = big.NewInt(params.BlobBaseCost)
reservePrice = baseCost.Mul(baseCost, parent.BaseFee)
blobPrice = calcBlobPrice(config, parent)
)
if reservePrice.Cmp(blobPrice) > 0 {
max := MaxBlobsPerBlock(config, headTimestamp)
scaledExcess := parentBlobGasUsed * uint64(max-target) / uint64(max)
return parentExcessBlobGas + scaledExcess
}
return excessBlobGas - targetGas return excessBlobGas - targetGas
} }
// CalcBlobFee calculates the blobfee from the header's excess blob gas field. // CalcBlobFee calculates the blobfee from the header's excess blob gas field.
func CalcBlobFee(config *params.ChainConfig, header *types.Header) *big.Int { func CalcBlobFee(config *params.ChainConfig, header *types.Header) *big.Int {
var frac uint64 blobConfig := latestBlobConfig(config, header.Time)
switch config.LatestFork(header.Time) { if blobConfig == nil {
case forks.Osaka:
frac = config.BlobScheduleConfig.Osaka.UpdateFraction
case forks.Prague:
frac = config.BlobScheduleConfig.Prague.UpdateFraction
case forks.Cancun:
frac = config.BlobScheduleConfig.Cancun.UpdateFraction
default:
panic("calculating blob fee on unsupported fork") panic("calculating blob fee on unsupported fork")
} }
return fakeExponential(minBlobGasPrice, new(big.Int).SetUint64(*header.ExcessBlobGas), new(big.Int).SetUint64(frac)) return fakeExponential(minBlobGasPrice, new(big.Int).SetUint64(*header.ExcessBlobGas), new(big.Int).SetUint64(blobConfig.UpdateFraction))
} }
// MaxBlobsPerBlock returns the max blobs per block for a block at the given timestamp. // MaxBlobsPerBlock returns the max blobs per block for a block at the given timestamp.
func MaxBlobsPerBlock(cfg *params.ChainConfig, time uint64) int { func MaxBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
if cfg.BlobScheduleConfig == nil { blobConfig := latestBlobConfig(cfg, time)
if blobConfig == nil {
return 0 return 0
} }
return blobConfig.Max
}
func latestBlobConfig(cfg *params.ChainConfig, time uint64) *params.BlobConfig {
if cfg.BlobScheduleConfig == nil {
return nil
}
var ( var (
london = cfg.LondonBlock london = cfg.LondonBlock
s = cfg.BlobScheduleConfig s = cfg.BlobScheduleConfig
) )
switch { switch {
case cfg.IsBPO5(london, time) && s.BPO5 != nil:
return s.BPO5
case cfg.IsBPO4(london, time) && s.BPO4 != nil:
return s.BPO4
case cfg.IsBPO3(london, time) && s.BPO3 != nil:
return s.BPO3
case cfg.IsBPO2(london, time) && s.BPO2 != nil:
return s.BPO2
case cfg.IsBPO1(london, time) && s.BPO1 != nil:
return s.BPO1
case cfg.IsOsaka(london, time) && s.Osaka != nil: case cfg.IsOsaka(london, time) && s.Osaka != nil:
return s.Osaka.Max return s.Osaka
case cfg.IsPrague(london, time) && s.Prague != nil: case cfg.IsPrague(london, time) && s.Prague != nil:
return s.Prague.Max return s.Prague
case cfg.IsCancun(london, time) && s.Cancun != nil: case cfg.IsCancun(london, time) && s.Cancun != nil:
return s.Cancun.Max return s.Cancun
default: default:
return 0 return nil
} }
} }
// MaxBlobsPerBlock returns the maximum blob gas that can be spent in a block at the given timestamp. // MaxBlobGasPerBlock returns the maximum blob gas that can be spent in a block at the given timestamp.
func MaxBlobGasPerBlock(cfg *params.ChainConfig, time uint64) uint64 { func MaxBlobGasPerBlock(cfg *params.ChainConfig, time uint64) uint64 {
return uint64(MaxBlobsPerBlock(cfg, time)) * params.BlobTxBlobGasPerBlob return uint64(MaxBlobsPerBlock(cfg, time)) * params.BlobTxBlobGasPerBlob
} }
@ -129,6 +158,16 @@ func LatestMaxBlobsPerBlock(cfg *params.ChainConfig) int {
return 0 return 0
} }
switch { switch {
case s.BPO5 != nil:
return s.BPO5.Max
case s.BPO4 != nil:
return s.BPO4.Max
case s.BPO3 != nil:
return s.BPO3.Max
case s.BPO2 != nil:
return s.BPO2.Max
case s.BPO1 != nil:
return s.BPO1.Max
case s.Osaka != nil: case s.Osaka != nil:
return s.Osaka.Max return s.Osaka.Max
case s.Prague != nil: case s.Prague != nil:
@ -142,23 +181,11 @@ func LatestMaxBlobsPerBlock(cfg *params.ChainConfig) int {
// targetBlobsPerBlock returns the target number of blobs in a block at the given timestamp. // targetBlobsPerBlock returns the target number of blobs in a block at the given timestamp.
func targetBlobsPerBlock(cfg *params.ChainConfig, time uint64) int { func targetBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
if cfg.BlobScheduleConfig == nil { blobConfig := latestBlobConfig(cfg, time)
return 0 if blobConfig == nil {
}
var (
london = cfg.LondonBlock
s = cfg.BlobScheduleConfig
)
switch {
case cfg.IsOsaka(london, time) && s.Osaka != nil:
return s.Osaka.Target
case cfg.IsPrague(london, time) && s.Prague != nil:
return s.Prague.Target
case cfg.IsCancun(london, time) && s.Cancun != nil:
return s.Cancun.Target
default:
return 0 return 0
} }
return blobConfig.Target
} }
// fakeExponential approximates factor * e ** (numerator / denominator) using // fakeExponential approximates factor * e ** (numerator / denominator) using
@ -177,3 +204,9 @@ func fakeExponential(factor, numerator, denominator *big.Int) *big.Int {
} }
return output.Div(output, denominator) return output.Div(output, denominator)
} }
// calcBlobPrice calculates the blob price for a block.
func calcBlobPrice(config *params.ChainConfig, header *types.Header) *big.Int {
blobBaseFee := CalcBlobFee(config, header)
return new(big.Int).Mul(blobBaseFee, big.NewInt(params.BlobTxBlobGasPerBlob))
}

View file

@ -127,3 +127,43 @@ func TestFakeExponential(t *testing.T) {
} }
} }
} }
func TestCalcExcessBlobGasEIP7918(t *testing.T) {
var (
cfg = params.MergedTestChainConfig
targetBlobs = targetBlobsPerBlock(cfg, *cfg.CancunTime)
blobGasTarget = uint64(targetBlobs) * params.BlobTxBlobGasPerBlob
)
makeHeader := func(parentExcess, parentBaseFee uint64, blobsUsed int) *types.Header {
blobGasUsed := uint64(blobsUsed) * params.BlobTxBlobGasPerBlob
return &types.Header{
BaseFee: big.NewInt(int64(parentBaseFee)),
ExcessBlobGas: &parentExcess,
BlobGasUsed: &blobGasUsed,
}
}
tests := []struct {
name string
header *types.Header
wantExcessGas uint64
}{
{
name: "BelowReservePrice",
header: makeHeader(0, 1_000_000_000, targetBlobs),
wantExcessGas: blobGasTarget * 3 / 9,
},
{
name: "AboveReservePrice",
header: makeHeader(0, 1, targetBlobs),
wantExcessGas: 0,
},
}
for _, tc := range tests {
got := CalcExcessBlobGas(cfg, tc.header, *cfg.CancunTime)
if got != tc.wantExcessGas {
t.Fatalf("%s: excess-blob-gas mismatch have %d, want %d",
tc.name, got, tc.wantExcessGas)
}
}
}

View file

@ -49,6 +49,10 @@ func NewBlockValidator(config *params.ChainConfig, blockchain *BlockChain) *Bloc
// header's transaction and uncle roots. The headers are assumed to be already // header's transaction and uncle roots. The headers are assumed to be already
// validated at this point. // validated at this point.
func (v *BlockValidator) ValidateBody(block *types.Block) error { func (v *BlockValidator) ValidateBody(block *types.Block) error {
// check EIP 7934 RLP-encoded block size cap
if v.config.IsOsaka(block.Number(), block.Time()) && block.Size() > params.MaxBlockSize {
return ErrBlockOversized
}
// Check whether the block is already imported. // Check whether the block is already imported.
if v.bc.HasBlockAndState(block.Hash(), block.NumberU64()) { if v.bc.HasBlockAndState(block.Hash(), block.NumberU64()) {
return ErrKnownBlock return ErrKnownBlock

View file

@ -162,10 +162,11 @@ const (
// BlockChainConfig contains the configuration of the BlockChain object. // BlockChainConfig contains the configuration of the BlockChain object.
type BlockChainConfig struct { type BlockChainConfig struct {
// Trie database related options // Trie database related options
TrieCleanLimit int // Memory allowance (MB) to use for caching trie nodes in memory TrieCleanLimit int // Memory allowance (MB) to use for caching trie nodes in memory
TrieDirtyLimit int // Memory limit (MB) at which to start flushing dirty trie nodes to disk TrieDirtyLimit int // Memory limit (MB) at which to start flushing dirty trie nodes to disk
TrieTimeLimit time.Duration // Time limit after which to flush the current in-memory trie to disk TrieTimeLimit time.Duration // Time limit after which to flush the current in-memory trie to disk
TrieNoAsyncFlush bool // Whether the asynchronous buffer flushing is disallowed TrieNoAsyncFlush bool // Whether the asynchronous buffer flushing is disallowed
TrieJournalDirectory string // Directory path to the journal used for persisting trie data across node restarts
Preimages bool // Whether to store preimage of trie key to the disk Preimages bool // Whether to store preimage of trie key to the disk
StateHistory uint64 // Number of blocks from head whose state histories are reserved. StateHistory uint64 // Number of blocks from head whose state histories are reserved.
@ -246,6 +247,7 @@ func (cfg *BlockChainConfig) triedbConfig(isVerkle bool) *triedb.Config {
EnableStateIndexing: cfg.ArchiveMode, EnableStateIndexing: cfg.ArchiveMode,
TrieCleanSize: cfg.TrieCleanLimit * 1024 * 1024, TrieCleanSize: cfg.TrieCleanLimit * 1024 * 1024,
StateCleanSize: cfg.SnapshotLimit * 1024 * 1024, StateCleanSize: cfg.SnapshotLimit * 1024 * 1024,
JournalDirectory: cfg.TrieJournalDirectory,
// TODO(rjl493456442): The write buffer represents the memory limit used // TODO(rjl493456442): The write buffer represents the memory limit used
// for flushing both trie data and state data to disk. The config name // for flushing both trie data and state data to disk. The config name
@ -314,7 +316,7 @@ type BlockChain struct {
bodyCache *lru.Cache[common.Hash, *types.Body] bodyCache *lru.Cache[common.Hash, *types.Body]
bodyRLPCache *lru.Cache[common.Hash, rlp.RawValue] bodyRLPCache *lru.Cache[common.Hash, rlp.RawValue]
receiptsCache *lru.Cache[common.Hash, []*types.Receipt] receiptsCache *lru.Cache[common.Hash, []*types.Receipt] // Receipts cache with all fields derived
blockCache *lru.Cache[common.Hash, *types.Block] blockCache *lru.Cache[common.Hash, *types.Block]
txLookupLock sync.RWMutex txLookupLock sync.RWMutex
@ -680,7 +682,7 @@ func (bc *BlockChain) initializeHistoryPruning(latest uint64) error {
predefinedPoint := history.PrunePoints[bc.genesisBlock.Hash()] predefinedPoint := history.PrunePoints[bc.genesisBlock.Hash()]
if predefinedPoint == nil || freezerTail != predefinedPoint.BlockNumber { if predefinedPoint == nil || freezerTail != predefinedPoint.BlockNumber {
log.Error("Chain history database is pruned with unknown configuration", "tail", freezerTail) log.Error("Chain history database is pruned with unknown configuration", "tail", freezerTail)
return fmt.Errorf("unexpected database tail") return errors.New("unexpected database tail")
} }
bc.historyPrunePoint.Store(predefinedPoint) bc.historyPrunePoint.Store(predefinedPoint)
return nil return nil
@ -693,15 +695,15 @@ func (bc *BlockChain) initializeHistoryPruning(latest uint64) error {
// action to happen. So just tell them how to do it. // action to happen. So just tell them how to do it.
log.Error(fmt.Sprintf("Chain history mode is configured as %q, but database is not pruned.", bc.cfg.ChainHistoryMode.String())) log.Error(fmt.Sprintf("Chain history mode is configured as %q, but database is not pruned.", bc.cfg.ChainHistoryMode.String()))
log.Error(fmt.Sprintf("Run 'geth prune-history' to prune pre-merge history.")) log.Error(fmt.Sprintf("Run 'geth prune-history' to prune pre-merge history."))
return fmt.Errorf("history pruning requested via configuration") return errors.New("history pruning requested via configuration")
} }
predefinedPoint := history.PrunePoints[bc.genesisBlock.Hash()] predefinedPoint := history.PrunePoints[bc.genesisBlock.Hash()]
if predefinedPoint == nil { if predefinedPoint == nil {
log.Error("Chain history pruning is not supported for this network", "genesis", bc.genesisBlock.Hash()) log.Error("Chain history pruning is not supported for this network", "genesis", bc.genesisBlock.Hash())
return fmt.Errorf("history pruning requested for unknown network") return errors.New("history pruning requested for unknown network")
} else if freezerTail > 0 && freezerTail != predefinedPoint.BlockNumber { } else if freezerTail > 0 && freezerTail != predefinedPoint.BlockNumber {
log.Error("Chain history database is pruned to unknown block", "tail", freezerTail) log.Error("Chain history database is pruned to unknown block", "tail", freezerTail)
return fmt.Errorf("unexpected database tail") return errors.New("unexpected database tail")
} }
bc.historyPrunePoint.Store(predefinedPoint) bc.historyPrunePoint.Store(predefinedPoint)
return nil return nil

View file

@ -18,9 +18,12 @@ package core
import ( import (
"errors" "errors"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
"github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state/snapshot" "github.com/ethereum/go-ethereum/core/state/snapshot"
@ -88,7 +91,10 @@ func (bc *BlockChain) GetHeaderByNumber(number uint64) *types.Header {
// GetBlockNumber retrieves the block number associated with a block hash. // GetBlockNumber retrieves the block number associated with a block hash.
func (bc *BlockChain) GetBlockNumber(hash common.Hash) *uint64 { func (bc *BlockChain) GetBlockNumber(hash common.Hash) *uint64 {
return bc.hc.GetBlockNumber(hash) if num, ok := bc.hc.GetBlockNumber(hash); ok {
return &num
}
return nil
} }
// GetHeadersFrom returns a contiguous segment of headers, in rlp-form, going // GetHeadersFrom returns a contiguous segment of headers, in rlp-form, going
@ -104,11 +110,11 @@ func (bc *BlockChain) GetBody(hash common.Hash) *types.Body {
if cached, ok := bc.bodyCache.Get(hash); ok { if cached, ok := bc.bodyCache.Get(hash); ok {
return cached return cached
} }
number := bc.hc.GetBlockNumber(hash) number, ok := bc.hc.GetBlockNumber(hash)
if number == nil { if !ok {
return nil return nil
} }
body := rawdb.ReadBody(bc.db, hash, *number) body := rawdb.ReadBody(bc.db, hash, number)
if body == nil { if body == nil {
return nil return nil
} }
@ -124,11 +130,11 @@ func (bc *BlockChain) GetBodyRLP(hash common.Hash) rlp.RawValue {
if cached, ok := bc.bodyRLPCache.Get(hash); ok { if cached, ok := bc.bodyRLPCache.Get(hash); ok {
return cached return cached
} }
number := bc.hc.GetBlockNumber(hash) number, ok := bc.hc.GetBlockNumber(hash)
if number == nil { if !ok {
return nil return nil
} }
body := rawdb.ReadBodyRLP(bc.db, hash, *number) body := rawdb.ReadBodyRLP(bc.db, hash, number)
if len(body) == 0 { if len(body) == 0 {
return nil return nil
} }
@ -177,11 +183,11 @@ func (bc *BlockChain) GetBlock(hash common.Hash, number uint64) *types.Block {
// GetBlockByHash retrieves a block from the database by hash, caching it if found. // GetBlockByHash retrieves a block from the database by hash, caching it if found.
func (bc *BlockChain) GetBlockByHash(hash common.Hash) *types.Block { func (bc *BlockChain) GetBlockByHash(hash common.Hash) *types.Block {
number := bc.hc.GetBlockNumber(hash) number, ok := bc.hc.GetBlockNumber(hash)
if number == nil { if !ok {
return nil return nil
} }
return bc.GetBlock(hash, *number) return bc.GetBlock(hash, number)
} }
// GetBlockByNumber retrieves a block from the database by number, caching it // GetBlockByNumber retrieves a block from the database by number, caching it
@ -197,36 +203,74 @@ func (bc *BlockChain) GetBlockByNumber(number uint64) *types.Block {
// GetBlocksFromHash returns the block corresponding to hash and up to n-1 ancestors. // GetBlocksFromHash returns the block corresponding to hash and up to n-1 ancestors.
// [deprecated by eth/62] // [deprecated by eth/62]
func (bc *BlockChain) GetBlocksFromHash(hash common.Hash, n int) (blocks []*types.Block) { func (bc *BlockChain) GetBlocksFromHash(hash common.Hash, n int) (blocks []*types.Block) {
number := bc.hc.GetBlockNumber(hash) number, ok := bc.hc.GetBlockNumber(hash)
if number == nil { if !ok {
return nil return nil
} }
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
block := bc.GetBlock(hash, *number) block := bc.GetBlock(hash, number)
if block == nil { if block == nil {
break break
} }
blocks = append(blocks, block) blocks = append(blocks, block)
hash = block.ParentHash() hash = block.ParentHash()
*number-- number--
} }
return return
} }
// GetCanonicalReceipt allows fetching a receipt for a transaction that was
// already looked up on the index. Notably, only receipt in canonical chain
// is visible.
func (bc *BlockChain) GetCanonicalReceipt(tx *types.Transaction, blockHash common.Hash, blockNumber, txIndex uint64) (*types.Receipt, error) {
// The receipt retrieved from the cache contains all previously derived fields
if receipts, ok := bc.receiptsCache.Get(blockHash); ok {
if int(txIndex) >= len(receipts) {
return nil, fmt.Errorf("receipt out of index, length: %d, index: %d", len(receipts), txIndex)
}
return receipts[int(txIndex)], nil
}
header := bc.GetHeader(blockHash, blockNumber)
if header == nil {
return nil, fmt.Errorf("block header is not found, %d, %x", blockNumber, blockHash)
}
var blobGasPrice *big.Int
if header.ExcessBlobGas != nil {
blobGasPrice = eip4844.CalcBlobFee(bc.chainConfig, header)
}
receipt, ctx, err := rawdb.ReadCanonicalRawReceipt(bc.db, blockHash, blockNumber, txIndex)
if err != nil {
return nil, err
}
signer := types.MakeSigner(bc.chainConfig, new(big.Int).SetUint64(blockNumber), header.Time)
receipt.DeriveFields(signer, types.DeriveReceiptContext{
BlockHash: blockHash,
BlockNumber: blockNumber,
BlockTime: header.Time,
BaseFee: header.BaseFee,
BlobGasPrice: blobGasPrice,
GasUsed: ctx.GasUsed,
LogIndex: ctx.LogIndex,
Tx: tx,
TxIndex: uint(txIndex),
})
return receipt, nil
}
// GetReceiptsByHash retrieves the receipts for all transactions in a given block. // GetReceiptsByHash retrieves the receipts for all transactions in a given block.
func (bc *BlockChain) GetReceiptsByHash(hash common.Hash) types.Receipts { func (bc *BlockChain) GetReceiptsByHash(hash common.Hash) types.Receipts {
if receipts, ok := bc.receiptsCache.Get(hash); ok { if receipts, ok := bc.receiptsCache.Get(hash); ok {
return receipts return receipts
} }
number := rawdb.ReadHeaderNumber(bc.db, hash) number, ok := rawdb.ReadHeaderNumber(bc.db, hash)
if number == nil { if !ok {
return nil return nil
} }
header := bc.GetHeader(hash, *number) header := bc.GetHeader(hash, number)
if header == nil { if header == nil {
return nil return nil
} }
receipts := rawdb.ReadReceipts(bc.db, hash, *number, header.Time, bc.chainConfig) receipts := rawdb.ReadReceipts(bc.db, hash, number, header.Time, bc.chainConfig)
if receipts == nil { if receipts == nil {
return nil return nil
} }
@ -245,11 +289,11 @@ func (bc *BlockChain) GetRawReceipts(hash common.Hash, number uint64) types.Rece
// GetReceiptsRLP retrieves the receipts of a block. // GetReceiptsRLP retrieves the receipts of a block.
func (bc *BlockChain) GetReceiptsRLP(hash common.Hash) rlp.RawValue { func (bc *BlockChain) GetReceiptsRLP(hash common.Hash) rlp.RawValue {
number := rawdb.ReadHeaderNumber(bc.db, hash) number, ok := rawdb.ReadHeaderNumber(bc.db, hash)
if number == nil { if !ok {
return nil return nil
} }
return rawdb.ReadReceiptsRLP(bc.db, hash, *number) return rawdb.ReadReceiptsRLP(bc.db, hash, number)
} }
// GetUnclesInChain retrieves all the uncles from a given block backwards until // GetUnclesInChain retrieves all the uncles from a given block backwards until
@ -277,13 +321,15 @@ func (bc *BlockChain) GetAncestor(hash common.Hash, number, ancestor uint64, max
return bc.hc.GetAncestor(hash, number, ancestor, maxNonCanonical) return bc.hc.GetAncestor(hash, number, ancestor, maxNonCanonical)
} }
// GetTransactionLookup retrieves the lookup along with the transaction // GetCanonicalTransaction retrieves the lookup along with the transaction
// itself associate with the given transaction hash. // itself associate with the given transaction hash.
// //
// A null will be returned if the transaction is not found. This can be due to // A null will be returned if the transaction is not found. This can be due to
// the transaction indexer not being finished. The caller must explicitly check // the transaction indexer not being finished. The caller must explicitly check
// the indexer progress. // the indexer progress.
func (bc *BlockChain) GetTransactionLookup(hash common.Hash) (*rawdb.LegacyTxLookupEntry, *types.Transaction) { //
// Notably, only the transaction in the canonical chain is visible.
func (bc *BlockChain) GetCanonicalTransaction(hash common.Hash) (*rawdb.LegacyTxLookupEntry, *types.Transaction) {
bc.txLookupLock.RLock() bc.txLookupLock.RLock()
defer bc.txLookupLock.RUnlock() defer bc.txLookupLock.RUnlock()
@ -291,7 +337,7 @@ func (bc *BlockChain) GetTransactionLookup(hash common.Hash) (*rawdb.LegacyTxLoo
if item, exist := bc.txLookupCache.Get(hash); exist { if item, exist := bc.txLookupCache.Get(hash); exist {
return item.lookup, item.transaction return item.lookup, item.transaction
} }
tx, blockHash, blockNumber, txIndex := rawdb.ReadTransaction(bc.db, hash) tx, blockHash, blockNumber, txIndex := rawdb.ReadCanonicalTransaction(bc.db, hash)
if tx == nil { if tx == nil {
return nil, nil return nil, nil
} }

View file

@ -25,10 +25,12 @@ import (
"math/rand" "math/rand"
"os" "os"
"path" "path"
"reflect"
"sync" "sync"
"testing" "testing"
"time" "time"
"github.com/davecgh/go-spew/spew"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus/beacon" "github.com/ethereum/go-ethereum/consensus/beacon"
@ -46,6 +48,7 @@ import (
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie"
"github.com/holiman/uint256" "github.com/holiman/uint256"
"github.com/stretchr/testify/assert"
) )
// So we can deterministically seed different blockchains // So we can deterministically seed different blockchains
@ -779,13 +782,13 @@ func testFastVsFullChains(t *testing.T, scheme string) {
} }
// Check that hash-to-number mappings are present in all databases. // Check that hash-to-number mappings are present in all databases.
if m := rawdb.ReadHeaderNumber(fastDb, hash); m == nil || *m != num { if m, ok := rawdb.ReadHeaderNumber(fastDb, hash); !ok || m != num {
t.Errorf("block #%d [%x]: wrong hash-to-number mapping in fastdb: %v", num, hash, m) t.Errorf("block #%d [%x]: wrong hash-to-number mapping in fastdb: %v", num, hash, m)
} }
if m := rawdb.ReadHeaderNumber(ancientDb, hash); m == nil || *m != num { if m, ok := rawdb.ReadHeaderNumber(ancientDb, hash); !ok || m != num {
t.Errorf("block #%d [%x]: wrong hash-to-number mapping in ancientdb: %v", num, hash, m) t.Errorf("block #%d [%x]: wrong hash-to-number mapping in ancientdb: %v", num, hash, m)
} }
if m := rawdb.ReadHeaderNumber(archiveDb, hash); m == nil || *m != num { if m, ok := rawdb.ReadHeaderNumber(archiveDb, hash); !ok || m != num {
t.Errorf("block #%d [%x]: wrong hash-to-number mapping in archivedb: %v", num, hash, m) t.Errorf("block #%d [%x]: wrong hash-to-number mapping in archivedb: %v", num, hash, m)
} }
} }
@ -1004,29 +1007,47 @@ func testChainTxReorgs(t *testing.T, scheme string) {
// removed tx // removed tx
for i, tx := range (types.Transactions{pastDrop, freshDrop}) { for i, tx := range (types.Transactions{pastDrop, freshDrop}) {
if txn, _, _, _ := rawdb.ReadTransaction(db, tx.Hash()); txn != nil { if txn, _, _, _ := rawdb.ReadCanonicalTransaction(db, tx.Hash()); txn != nil {
t.Errorf("drop %d: tx %v found while shouldn't have been", i, txn) t.Errorf("drop %d: tx %v found while shouldn't have been", i, txn)
} }
if rcpt, _, _, _ := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt != nil { if rcpt, _, _, _ := rawdb.ReadCanonicalReceipt(db, tx.Hash(), blockchain.Config()); rcpt != nil {
t.Errorf("drop %d: receipt %v found while shouldn't have been", i, rcpt) t.Errorf("drop %d: receipt %v found while shouldn't have been", i, rcpt)
} }
} }
// added tx // added tx
for i, tx := range (types.Transactions{pastAdd, freshAdd, futureAdd}) { for i, tx := range (types.Transactions{pastAdd, freshAdd, futureAdd}) {
if txn, _, _, _ := rawdb.ReadTransaction(db, tx.Hash()); txn == nil { if txn, _, _, _ := rawdb.ReadCanonicalTransaction(db, tx.Hash()); txn == nil {
t.Errorf("add %d: expected tx to be found", i) t.Errorf("add %d: expected tx to be found", i)
} }
if rcpt, _, _, _ := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil { if rcpt, _, _, index := rawdb.ReadCanonicalReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil {
t.Errorf("add %d: expected receipt to be found", i) t.Errorf("add %d: expected receipt to be found", i)
} else if rawRcpt, ctx, _ := rawdb.ReadCanonicalRawReceipt(db, rcpt.BlockHash, rcpt.BlockNumber.Uint64(), index); rawRcpt == nil {
t.Errorf("add %d: expected raw receipt to be found", i)
} else {
if rcpt.GasUsed != ctx.GasUsed {
t.Errorf("add %d, raw gasUsedSoFar doesn't make sense", i)
}
if len(rcpt.Logs) > 0 && rcpt.Logs[0].Index != ctx.LogIndex {
t.Errorf("add %d, raw startingLogIndex doesn't make sense", i)
}
} }
} }
// shared tx // shared tx
for i, tx := range (types.Transactions{postponed, swapped}) { for i, tx := range (types.Transactions{postponed, swapped}) {
if txn, _, _, _ := rawdb.ReadTransaction(db, tx.Hash()); txn == nil { if txn, _, _, _ := rawdb.ReadCanonicalTransaction(db, tx.Hash()); txn == nil {
t.Errorf("share %d: expected tx to be found", i) t.Errorf("share %d: expected tx to be found", i)
} }
if rcpt, _, _, _ := rawdb.ReadReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil { if rcpt, _, _, index := rawdb.ReadCanonicalReceipt(db, tx.Hash(), blockchain.Config()); rcpt == nil {
t.Errorf("share %d: expected receipt to be found", i) t.Errorf("share %d: expected receipt to be found", i)
} else if rawRcpt, ctx, _ := rawdb.ReadCanonicalRawReceipt(db, rcpt.BlockHash, rcpt.BlockNumber.Uint64(), index); rawRcpt == nil {
t.Errorf("add %d: expected raw receipt to be found", i)
} else {
if rcpt.GasUsed != ctx.GasUsed {
t.Errorf("add %d, raw gasUsedSoFar doesn't make sense", i)
}
if len(rcpt.Logs) > 0 && rcpt.Logs[0].Index != ctx.LogIndex {
t.Errorf("add %d, raw startingLogIndex doesn't make sense", i)
}
} }
} }
} }
@ -4404,6 +4425,93 @@ func testInsertChainWithCutoff(t *testing.T, cutoff uint64, ancientLimit uint64,
if receipts == nil || len(receipts) != 1 { if receipts == nil || len(receipts) != 1 {
t.Fatalf("Missed block receipts: %d, cutoff: %d", num, cutoffBlock.NumberU64()) t.Fatalf("Missed block receipts: %d, cutoff: %d", num, cutoffBlock.NumberU64())
} }
for indx, receipt := range receipts {
receiptByLookup, err := chain.GetCanonicalReceipt(body.Transactions[indx], receipt.BlockHash,
receipt.BlockNumber.Uint64(), uint64(indx))
assert.NoError(t, err)
assert.Equal(t, receipt, receiptByLookup)
}
}
}
}
func TestGetCanonicalReceipt(t *testing.T) {
const chainLength = 64
// Configure and generate a sample block chain
var (
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
address = crypto.PubkeyToAddress(key.PublicKey)
funds = big.NewInt(1000000000000000000)
gspec = &Genesis{
Config: params.MergedTestChainConfig,
Alloc: types.GenesisAlloc{address: {Balance: funds}},
BaseFee: big.NewInt(params.InitialBaseFee),
}
signer = types.LatestSigner(gspec.Config)
engine = beacon.New(ethash.NewFaker())
codeBin = common.FromHex("0x608060405234801561000f575f5ffd5b507f8ae1c8c6e5f91159d0bc1c4b9a47ce45301753843012cbe641e4456bfc73538b33426040516100419291906100ff565b60405180910390a1610139565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100778261004e565b9050919050565b6100878161006d565b82525050565b5f819050919050565b61009f8161008d565b82525050565b5f82825260208201905092915050565b7f436f6e7374727563746f72207761732063616c6c6564000000000000000000005f82015250565b5f6100e96016836100a5565b91506100f4826100b5565b602082019050919050565b5f6060820190506101125f83018561007e565b61011f6020830184610096565b8181036040830152610130816100dd565b90509392505050565b603e806101455f395ff3fe60806040525f5ffdfea2646970667358221220e8bc3c31e3ac337eab702e8fdfc1c71894f4df1af4221bcde4a2823360f403fb64736f6c634300081e0033")
)
_, blocks, receipts := GenerateChainWithGenesis(gspec, engine, chainLength, func(i int, block *BlockGen) {
// SPDX-License-Identifier: MIT
// pragma solidity ^0.8.0;
//
// contract ConstructorLogger {
// event ConstructorLog(address sender, uint256 timestamp, string message);
//
// constructor() {
// emit ConstructorLog(msg.sender, block.timestamp, "Constructor was called");
// }
// }
//
// 608060405234801561000f575f5ffd5b507f8ae1c8c6e5f91159d0bc1c4b9a47ce45301753843012cbe641e4456bfc73538b33426040516100419291906100ff565b60405180910390a1610139565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100778261004e565b9050919050565b6100878161006d565b82525050565b5f819050919050565b61009f8161008d565b82525050565b5f82825260208201905092915050565b7f436f6e7374727563746f72207761732063616c6c6564000000000000000000005f82015250565b5f6100e96016836100a5565b91506100f4826100b5565b602082019050919050565b5f6060820190506101125f83018561007e565b61011f6020830184610096565b8181036040830152610130816100dd565b90509392505050565b603e806101455f395ff3fe60806040525f5ffdfea2646970667358221220e8bc3c31e3ac337eab702e8fdfc1c71894f4df1af4221bcde4a2823360f403fb64736f6c634300081e0033
nonce := block.TxNonce(address)
tx, err := types.SignTx(types.NewContractCreation(nonce, big.NewInt(0), 100_000, block.header.BaseFee, codeBin), signer, key)
if err != nil {
panic(err)
}
block.AddTx(tx)
tx2, err := types.SignTx(types.NewContractCreation(nonce+1, big.NewInt(0), 100_000, block.header.BaseFee, codeBin), signer, key)
if err != nil {
panic(err)
}
block.AddTx(tx2)
tx3, err := types.SignTx(types.NewContractCreation(nonce+2, big.NewInt(0), 100_000, block.header.BaseFee, codeBin), signer, key)
if err != nil {
panic(err)
}
block.AddTx(tx3)
})
db, _ := rawdb.Open(rawdb.NewMemoryDatabase(), rawdb.OpenOptions{})
defer db.Close()
options := DefaultConfig().WithStateScheme(rawdb.PathScheme)
chain, _ := NewBlockChain(db, gspec, beacon.New(ethash.NewFaker()), options)
defer chain.Stop()
chain.InsertReceiptChain(blocks, types.EncodeBlockReceiptLists(receipts), 0)
for i := 0; i < chainLength; i++ {
block := blocks[i]
blockReceipts := chain.GetReceiptsByHash(block.Hash())
chain.receiptsCache.Purge() // ugly hack
for txIndex, tx := range block.Body().Transactions {
receipt, err := chain.GetCanonicalReceipt(tx, block.Hash(), block.NumberU64(), uint64(txIndex))
if err != nil {
t.Fatalf("Unexpected error %v", err)
}
if !reflect.DeepEqual(receipts[i][txIndex], receipt) {
want := spew.Sdump(receipts[i][txIndex])
got := spew.Sdump(receipt)
t.Fatalf("Receipt is not matched, want %s, got: %s", want, got)
}
if !reflect.DeepEqual(blockReceipts[txIndex], receipt) {
want := spew.Sdump(blockReceipts[txIndex])
got := spew.Sdump(receipt)
t.Fatalf("Receipt is not matched, want %s, got: %s", want, got)
}
} }
} }
} }

View file

@ -540,8 +540,10 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine
return block, b.receipts return block, b.receipts
} }
sdb := state.NewDatabase(trdb, nil)
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
statedb, err := state.New(parent.Root(), state.NewDatabase(trdb, nil)) statedb, err := state.New(parent.Root(), sdb)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View file

@ -28,6 +28,10 @@ var (
// ErrNoGenesis is returned when there is no Genesis Block. // ErrNoGenesis is returned when there is no Genesis Block.
ErrNoGenesis = errors.New("genesis not found in chain") ErrNoGenesis = errors.New("genesis not found in chain")
// ErrBlockOversized is returned if the size of the RLP-encoded block
// exceeds the cap established by EIP 7934
ErrBlockOversized = errors.New("block RLP-encoded size exceeds maximum")
) )
// List of evm-call-message pre-checking errors. All state transition messages will // List of evm-call-message pre-checking errors. All state transition messages will
@ -114,6 +118,9 @@ var (
// ErrMissingBlobHashes is returned if a blob transaction has no blob hashes. // ErrMissingBlobHashes is returned if a blob transaction has no blob hashes.
ErrMissingBlobHashes = errors.New("blob transaction missing blob hashes") ErrMissingBlobHashes = errors.New("blob transaction missing blob hashes")
// ErrTooManyBlobs is returned if a blob transaction exceeds the maximum number of blobs.
ErrTooManyBlobs = errors.New("blob transaction has too many blobs")
// ErrBlobTxCreate is returned if a blob transaction has no explicit to field. // ErrBlobTxCreate is returned if a blob transaction has no explicit to field.
ErrBlobTxCreate = errors.New("blob transaction of type create") ErrBlobTxCreate = errors.New("blob transaction of type create")
@ -122,6 +129,9 @@ var (
// Message validation errors: // Message validation errors:
ErrEmptyAuthList = errors.New("EIP-7702 transaction with empty auth list") ErrEmptyAuthList = errors.New("EIP-7702 transaction with empty auth list")
ErrSetCodeTxCreate = errors.New("EIP-7702 transaction cannot be used to create contract") ErrSetCodeTxCreate = errors.New("EIP-7702 transaction cannot be used to create contract")
// -- EIP-7825 errors --
ErrGasLimitTooHigh = errors.New("transaction gas limit too high")
) )
// EIP-7702 state transition errors. // EIP-7702 state transition errors.

View file

@ -55,7 +55,9 @@ func NewChainView(chain blockchain, number uint64, hash common.Hash) *ChainView
headNumber: number, headNumber: number,
hashes: []common.Hash{hash}, hashes: []common.Hash{hash},
} }
cv.extendNonCanonical() if !cv.extendNonCanonical() {
return nil
}
return cv return cv
} }
@ -129,7 +131,11 @@ func (cv *ChainView) SharedRange(cv2 *ChainView) common.Range[uint64] {
return common.Range[uint64]{} return common.Range[uint64]{}
} }
var sharedLen uint64 var sharedLen uint64
for n := min(cv.headNumber+1-uint64(len(cv.hashes)), cv2.headNumber+1-uint64(len(cv2.hashes))); n <= cv.headNumber && n <= cv2.headNumber && cv.blockHash(n) == cv2.blockHash(n); n++ { for n := min(cv.headNumber+1-uint64(len(cv.hashes)), cv2.headNumber+1-uint64(len(cv2.hashes))); n <= cv.headNumber && n <= cv2.headNumber; n++ {
h1, h2 := cv.blockHash(n), cv2.blockHash(n)
if h1 != h2 || h1 == (common.Hash{}) {
break
}
sharedLen = n + 1 sharedLen = n + 1
} }
return common.NewRange(0, sharedLen) return common.NewRange(0, sharedLen)
@ -153,10 +159,13 @@ func matchViews(cv1, cv2 *ChainView, number uint64) bool {
if cv1.headNumber < number || cv2.headNumber < number { if cv1.headNumber < number || cv2.headNumber < number {
return false return false
} }
var h1, h2 common.Hash
if number == cv1.headNumber || number == cv2.headNumber { if number == cv1.headNumber || number == cv2.headNumber {
return cv1.BlockId(number) == cv2.BlockId(number) h1, h2 = cv1.BlockId(number), cv2.BlockId(number)
} else {
h1, h2 = cv1.BlockHash(number), cv2.BlockHash(number)
} }
return cv1.BlockHash(number) == cv2.BlockHash(number) return h1 == h2 && h1 != common.Hash{}
} }
// extendNonCanonical checks whether the previously known reverse list of head // extendNonCanonical checks whether the previously known reverse list of head
@ -175,7 +184,10 @@ func (cv *ChainView) extendNonCanonical() bool {
} }
header := cv.chain.GetHeader(hash, number) header := cv.chain.GetHeader(hash, number)
if header == nil { if header == nil {
log.Error("Header not found", "number", number, "hash", hash) // Header not found - this can happen after debug_setHead operations
// where blocks have been deleted. Return false to indicate the chain view
// is no longer valid rather than logging repeated errors.
log.Debug("Header not found during chain view extension", "number", number, "hash", hash)
return false return false
} }
cv.hashes = append(cv.hashes, header.ParentHash) cv.hashes = append(cv.hashes, header.ParentHash)

View file

@ -18,5 +18,11 @@
{"blockNumber": 3221725, "blockId": "0xe771f897dece48b1583cc1d1d10de8015da57407eb1fdf239fdbe46eaab85143", "firstIndex": 1140850137}, {"blockNumber": 3221725, "blockId": "0xe771f897dece48b1583cc1d1d10de8015da57407eb1fdf239fdbe46eaab85143", "firstIndex": 1140850137},
{"blockNumber": 3357164, "blockId": "0x6252d0aa54c79623b0680069c88d7b5c47983f0d5c4845b6c811b8d9b5e8ff3c", "firstIndex": 1207959453}, {"blockNumber": 3357164, "blockId": "0x6252d0aa54c79623b0680069c88d7b5c47983f0d5c4845b6c811b8d9b5e8ff3c", "firstIndex": 1207959453},
{"blockNumber": 3447019, "blockId": "0xeb7d585e1e063f3cc05ed399fbf6c2df63c271f62f030acb804e9fb1e74b6dc1", "firstIndex": 1275067542}, {"blockNumber": 3447019, "blockId": "0xeb7d585e1e063f3cc05ed399fbf6c2df63c271f62f030acb804e9fb1e74b6dc1", "firstIndex": 1275067542},
{"blockNumber": 3546397, "blockId": "0xdabdef7defa4281180a57c5af121877b82274f15ccf074ea0096146f4c246df2", "firstIndex": 1342176778} {"blockNumber": 3546397, "blockId": "0xdabdef7defa4281180a57c5af121877b82274f15ccf074ea0096146f4c246df2", "firstIndex": 1342176778},
{"blockNumber": 3867885, "blockId": "0x8be069dd7a3e2ffb869ee164d11b28555233d2510b134ab9d5484fdae55d2225", "firstIndex": 1409285539},
{"blockNumber": 3935446, "blockId": "0xc91a61bc215bbcccc3020c62e5c8153162df0d8bcc59813d74671b2d24903ed7", "firstIndex": 1476394742},
{"blockNumber": 3989508, "blockId": "0xc85dec36a767e44237842ef51915944c2a49780c8c394a3aa6cfb013c99cf58b", "firstIndex": 1543503452},
{"blockNumber": 4057078, "blockId": "0xccdb79f6705629cb6ab1667a1244938f60911236549143fcff23a3989213e67e", "firstIndex": 1610612030},
{"blockNumber": 4126499, "blockId": "0x92f2ef21fc911e87e81e38373d5f2915587b9648a0ab3cf4fcfe3e5aaffe7b85", "firstIndex": 1677720416},
{"blockNumber": 4239335, "blockId": "0x64fbd22965eb583a584552b7edb9b7ce26fb6aad247c1063d0d5a4d11cbcc58c", "firstIndex": 1744830176}
] ]

View file

@ -267,5 +267,26 @@
{"blockNumber": 22168652, "blockId": "0x6ae43618c915e636794e2cc2d75dde9992766881c7405fe6479c045ed4bee57e", "firstIndex": 17850956277}, {"blockNumber": 22168652, "blockId": "0x6ae43618c915e636794e2cc2d75dde9992766881c7405fe6479c045ed4bee57e", "firstIndex": 17850956277},
{"blockNumber": 22190975, "blockId": "0x9437121647899a4b7b84d67fbea7cc6ff967481c2eab4328ccd86e2cefe19420", "firstIndex": 17918066140}, {"blockNumber": 22190975, "blockId": "0x9437121647899a4b7b84d67fbea7cc6ff967481c2eab4328ccd86e2cefe19420", "firstIndex": 17918066140},
{"blockNumber": 22234357, "blockId": "0x036030830134f9224160d5a0b62da35ec7813dc8855d554bd22e9d38545243ed", "firstIndex": 17985175075}, {"blockNumber": 22234357, "blockId": "0x036030830134f9224160d5a0b62da35ec7813dc8855d554bd22e9d38545243ed", "firstIndex": 17985175075},
{"blockNumber": 22276736, "blockId": "0x5ceb96d98aa1b4c1c2f2fa253ae9cdb1b04e0420c11bf795400e8762c0a1635c", "firstIndex": 18052284344} {"blockNumber": 22276736, "blockId": "0x5ceb96d98aa1b4c1c2f2fa253ae9cdb1b04e0420c11bf795400e8762c0a1635c", "firstIndex": 18052284344},
{"blockNumber": 22321282, "blockId": "0x8a601ebf6a757020c6d43a978f0bd2c150c4acc1ffdd50c7ee88afc78b0c11f8", "firstIndex": 18119392242},
{"blockNumber": 22349231, "blockId": "0xb751c026a92ba5be95ad7ea4e2729a175b0d0e11a4c108f47cab232b4715d1a2", "firstIndex": 18186501218},
{"blockNumber": 22377469, "blockId": "0xa47916860a22f7e26761ec2d7f717410791bd3ed0237b2f6266750214c7bbf08", "firstIndex": 18253610249},
{"blockNumber": 22422685, "blockId": "0x8beaee39603af55fad222730f556c840c41cd76a5eef0bad367ac94d3b86c7aa", "firstIndex": 18320716377},
{"blockNumber": 22462378, "blockId": "0x6dba9c5d2949f5a6a072267b590e8b15e6fb157a0fc22719387f1fd6bfcd8d5d", "firstIndex": 18387828426},
{"blockNumber": 22500185, "blockId": "0x2484c380df0a8f7edfdf8d917570d23fab8499aea80c35b6cf4e5fe1e34106e9", "firstIndex": 18454936227},
{"blockNumber": 22539624, "blockId": "0xd418071906803d25afc3842a6a6468ad3b5fea27107b314ce4e2ccf08b478acf", "firstIndex": 18522044531},
{"blockNumber": 22577021, "blockId": "0xff222982693f3ff60d2097822171f80a6ddd979080aeb7e995bfb1b973497c84", "firstIndex": 18589154438},
{"blockNumber": 22614525, "blockId": "0x9868da1fea2ffca3f67e35570f02eb5707b27f6967ea4a109eb4ddbf24566efd", "firstIndex": 18656264174},
{"blockNumber": 22652848, "blockId": "0x060a911da11ab0f1dda307f5196e622d23901d198925749e70ab58a439477c5a", "firstIndex": 18723372617},
{"blockNumber": 22692432, "blockId": "0x6a937f2c283aba8c778c1f5ef340b225fd820f8a7dfa6f24f5fe541994f32f2d", "firstIndex": 18790480232},
{"blockNumber": 22731200, "blockId": "0x00d57a9e7a2dad252436fe9f0382c6a8860d301a9f9ffe6d7ac64c82b95300f8", "firstIndex": 18857590076},
{"blockNumber": 22769000, "blockId": "0xa48db20307c19c373ef2d31d85088ea14b8df0450491c31982504c87b04edbc0", "firstIndex": 18924699130},
{"blockNumber": 22808126, "blockId": "0x1419c64ff003edca0586f1c8ec3063da5c54c57ff826cfb34bc866cc18949653", "firstIndex": 18991807807},
{"blockNumber": 22845231, "blockId": "0x691f87217e61c5d7ae9ad53a44d30e1ab6b1cc3f2b689b9fbf7c38fbacacfe3e", "firstIndex": 19058917062},
{"blockNumber": 22884189, "blockId": "0x7f102d44c0ea7803f5b0e1a98a6abf0e8383eb99fb114d6f7b4591753ce8bba3", "firstIndex": 19126024122},
{"blockNumber": 22920923, "blockId": "0x04fe6179495016fc3fe56d8ef5311c360a5761a898262173849c3494fdd73d92", "firstIndex": 19193134595},
{"blockNumber": 22958100, "blockId": "0xe38e0ff7b0c4065ca42ea577bc32f2566ca46f2ddeedcc4bc1f8fb00e7f26329", "firstIndex": 19260242424},
{"blockNumber": 22988600, "blockId": "0x04ca74758b22e0ea54b8c992022ff21c16a2af9c45144c3b0f80de921a7eee82", "firstIndex": 19327351273},
{"blockNumber": 23018392, "blockId": "0x61cc979b00bc97b48356f986a5b9ec997d674bc904c2a2e4b0f17de08e50b3bb", "firstIndex": 19394459627},
{"blockNumber": 23048524, "blockId": "0x489de15d95739ede4ab15e8b5151d80d4dc85ae10e7be800b1a4723094a678df", "firstIndex": 19461570073}
] ]

View file

@ -68,5 +68,32 @@
{"blockNumber": 7911722, "blockId": "0x9a85e48e3135c97c51fc1786f2af0596c802e021b6c53cfca65a129cafcd23ed", "firstIndex": 4496287265}, {"blockNumber": 7911722, "blockId": "0x9a85e48e3135c97c51fc1786f2af0596c802e021b6c53cfca65a129cafcd23ed", "firstIndex": 4496287265},
{"blockNumber": 7960147, "blockId": "0xc9359cc76d7090e1c8a031108f0ab7a8935d971efd4325fe53612a1d99562f6f", "firstIndex": 4563402388}, {"blockNumber": 7960147, "blockId": "0xc9359cc76d7090e1c8a031108f0ab7a8935d971efd4325fe53612a1d99562f6f", "firstIndex": 4563402388},
{"blockNumber": 8030418, "blockId": "0x21867e68cd8327aed2da2601399d60f7f9e41dca4a4f2f9be982e5a2b9304a88", "firstIndex": 4630511616}, {"blockNumber": 8030418, "blockId": "0x21867e68cd8327aed2da2601399d60f7f9e41dca4a4f2f9be982e5a2b9304a88", "firstIndex": 4630511616},
{"blockNumber": 8087701, "blockId": "0x0fa8c8d7549cc9a8d308262706fe248efe759f8b63511efb1e7f3926e9af2dcb", "firstIndex": 4697614758} {"blockNumber": 8087701, "blockId": "0x0fa8c8d7549cc9a8d308262706fe248efe759f8b63511efb1e7f3926e9af2dcb", "firstIndex": 4697614758},
{"blockNumber": 8149130, "blockId": "0x655ea638fd9e35cc25f4332f260d7bf98f4f6fa9a72e1bff861209f18659e94c", "firstIndex": 4764727744},
{"blockNumber": 8208672, "blockId": "0xb5847a670dc3b6181f9e2e40e4218548048366d237a0d12e938b9879bc8cf800", "firstIndex": 4831837882},
{"blockNumber": 8271345, "blockId": "0x96797214946f29093883b877ccb0f2a9f771a9a3db3794a642b5dcb781c4d194", "firstIndex": 4898942160},
{"blockNumber": 8302858, "blockId": "0x6a5977b3382ca69a9e0412333f97b911c1f69f857d8f31dd0fc930980e24f2fc", "firstIndex": 4966054626},
{"blockNumber": 8333618, "blockId": "0x2547294aa23b67c42adbdddfcf424b17a95c4ff0f352a6a2442c529cfb0c892a", "firstIndex": 5033163605},
{"blockNumber": 8360582, "blockId": "0xf34f5dceb0ef22e0f782b56c12790472acc675997b9c45075bd4e18a9dacd03c", "firstIndex": 5100273631},
{"blockNumber": 8387230, "blockId": "0x0fbea42e87620b5beeb76b67febc173847c54333d7dce9fa2f8f2a3fa9c8c22a", "firstIndex": 5167381673},
{"blockNumber": 8414795, "blockId": "0x6c9c000cf5e35da3a7e9e1cd56147c8ce9b43a76d6de945675efd9dc03b628c9", "firstIndex": 5234477010},
{"blockNumber": 8444749, "blockId": "0xba85f8c9abaddc34e2113eb49385667ba4b008168ae701f46aa7a7ce78c633a1", "firstIndex": 5301598562},
{"blockNumber": 8474551, "blockId": "0x720866a40242f087dd25b6f0dd79224884f435b114a39e60c5669f5c942c78c1", "firstIndex": 5368707262},
{"blockNumber": 8501310, "blockId": "0x2b6da233532c701202fb5ac67e005f7d3eb71f88a9fac10c25d24dd11ada05e5", "firstIndex": 5435803858},
{"blockNumber": 8526970, "blockId": "0x005f9bbad0a10234129d09894d7fcf04bf1398d326510eedb4195808c282802d", "firstIndex": 5502926509},
{"blockNumber": 8550412, "blockId": "0x37c9f3efc9f33cf62f590087c8c9ac70011883f75e648647a6fd0fec00ca627c", "firstIndex": 5570034950},
{"blockNumber": 8573540, "blockId": "0x81cfb46a07be7c70bb8a0f76b03a4cd502f92032bea68ad7ba10e26351673000", "firstIndex": 5637137662},
{"blockNumber": 8590416, "blockId": "0x5c223d58ef22d7b0dd8c498e8498da4787b5dc706681c2bc83849441f5d0922d", "firstIndex": 5704252906},
{"blockNumber": 8616793, "blockId": "0x9043ce02742fb5ec43a696602867b7ce6003a95b36cd28a37eeb9785a46ad49f", "firstIndex": 5771357264},
{"blockNumber": 8647290, "blockId": "0xd90115193764b0a33f3f2a719381b3ddbce2532607c72fb287a864eb391eeada", "firstIndex": 5838466144},
{"blockNumber": 8673192, "blockId": "0x9bc92d340cccaf4c8c03372efc24eb92c5159106729de8d2e9e064f5568d082b", "firstIndex": 5905577457},
{"blockNumber": 8700694, "blockId": "0xb3d656a173b962bc6825198e94a4974289db06a8998060bd0f5ee2044a7a7deb", "firstIndex": 5972679345},
{"blockNumber": 8724533, "blockId": "0x253ffc6d77b88fe18736e4c313e9930341c444bc87b2ee22b26cfe8d9d0b178d", "firstIndex": 6039795829},
{"blockNumber": 8743948, "blockId": "0x04eb66d0261705d31e629193148d0685058d7759ba5f95d2d38e412dbadb8256", "firstIndex": 6106901747},
{"blockNumber": 8758378, "blockId": "0x64adf54e662d11db716610157da672c3d8b45f001dbce40a269871b86a84d026", "firstIndex": 6174011544},
{"blockNumber": 8777722, "blockId": "0x0a7f9a956024b404c915e70b42221aa027b2dd715b0697f099dccefae0b9af97", "firstIndex": 6241124215},
{"blockNumber": 8800154, "blockId": "0x411f90dc18f2bca31fa63615c2866c907bbac1fae8c06782cabfaf788efba665", "firstIndex": 6308233216},
{"blockNumber": 8829725, "blockId": "0x5686f3a5eec1b070d0113c588f8f4a560d57ad96b8045cedb5c08bbadaa0273e", "firstIndex": 6375340033},
{"blockNumber": 8858036, "blockId": "0x4f9b5d9fac9c6f6e2224f613cda12e8ab95d636774ce87489dce8a9f805ee2e5", "firstIndex": 6442450330},
{"blockNumber": 8884811, "blockId": "0x9cf74f978872683802c065e72b5a5326fdad95f19733c34d927b575cd85fd0bd", "firstIndex": 6509559380}
] ]

View file

@ -185,11 +185,14 @@ type filterMapsRange struct {
initialized bool initialized bool
headIndexed bool headIndexed bool
headDelimiter uint64 // zero if headIndexed is false headDelimiter uint64 // zero if headIndexed is false
// if initialized then all maps are rendered in the maps range // if initialized then all maps are rendered in the maps range
maps common.Range[uint32] maps common.Range[uint32]
// if tailPartialEpoch > 0 then maps between firstRenderedMap-mapsPerEpoch and // if tailPartialEpoch > 0 then maps between firstRenderedMap-mapsPerEpoch and
// firstRenderedMap-mapsPerEpoch+tailPartialEpoch-1 are rendered // firstRenderedMap-mapsPerEpoch+tailPartialEpoch-1 are rendered
tailPartialEpoch uint32 tailPartialEpoch uint32
// if initialized then all log values in the blocks range are fully // if initialized then all log values in the blocks range are fully
// rendered // rendered
// blockLvPointers are available in the blocks range // blockLvPointers are available in the blocks range
@ -223,13 +226,15 @@ type Config struct {
} }
// NewFilterMaps creates a new FilterMaps and starts the indexer. // NewFilterMaps creates a new FilterMaps and starts the indexer.
func NewFilterMaps(db ethdb.KeyValueStore, initView *ChainView, historyCutoff, finalBlock uint64, params Params, config Config) *FilterMaps { func NewFilterMaps(db ethdb.KeyValueStore, initView *ChainView, historyCutoff, finalBlock uint64, params Params, config Config) (*FilterMaps, error) {
rs, initialized, err := rawdb.ReadFilterMapsRange(db) rs, initialized, err := rawdb.ReadFilterMapsRange(db)
if err != nil || (initialized && rs.Version != databaseVersion) { if err != nil || (initialized && rs.Version != databaseVersion) {
rs, initialized = rawdb.FilterMapsRange{}, false rs, initialized = rawdb.FilterMapsRange{}, false
log.Warn("Invalid log index database version; resetting log index") log.Warn("Invalid log index database version; resetting log index")
} }
params.deriveFields() if err := params.sanitize(); err != nil {
return nil, err
}
f := &FilterMaps{ f := &FilterMaps{
db: db, db: db,
closeCh: make(chan struct{}), closeCh: make(chan struct{}),
@ -254,25 +259,24 @@ func NewFilterMaps(db ethdb.KeyValueStore, initView *ChainView, historyCutoff, f
}, },
// deleting last unindexed epoch might have been interrupted by shutdown // deleting last unindexed epoch might have been interrupted by shutdown
cleanedEpochsBefore: max(rs.MapsFirst>>params.logMapsPerEpoch, 1) - 1, cleanedEpochsBefore: max(rs.MapsFirst>>params.logMapsPerEpoch, 1) - 1,
historyCutoff: historyCutoff,
historyCutoff: historyCutoff, finalBlock: finalBlock,
finalBlock: finalBlock, matcherSyncCh: make(chan *FilterMapsMatcherBackend),
matcherSyncCh: make(chan *FilterMapsMatcherBackend), matchers: make(map[*FilterMapsMatcherBackend]struct{}),
matchers: make(map[*FilterMapsMatcherBackend]struct{}), filterMapCache: lru.NewCache[uint32, filterMap](cachedFilterMaps),
filterMapCache: lru.NewCache[uint32, filterMap](cachedFilterMaps), lastBlockCache: lru.NewCache[uint32, lastBlockOfMap](cachedLastBlocks),
lastBlockCache: lru.NewCache[uint32, lastBlockOfMap](cachedLastBlocks), lvPointerCache: lru.NewCache[uint64, uint64](cachedLvPointers),
lvPointerCache: lru.NewCache[uint64, uint64](cachedLvPointers), renderSnapshots: lru.NewCache[uint64, *renderedMap](cachedRenderSnapshots),
renderSnapshots: lru.NewCache[uint64, *renderedMap](cachedRenderSnapshots),
} }
f.checkRevertRange() // revert maps that are inconsistent with the current chain view f.checkRevertRange() // revert maps that are inconsistent with the current chain view
if f.indexedRange.hasIndexedBlocks() { if f.indexedRange.hasIndexedBlocks() {
log.Info("Initialized log indexer", log.Info("Initialized log indexer",
"first block", f.indexedRange.blocks.First(), "last block", f.indexedRange.blocks.Last(), "firstblock", f.indexedRange.blocks.First(), "lastblock", f.indexedRange.blocks.Last(),
"first map", f.indexedRange.maps.First(), "last map", f.indexedRange.maps.Last(), "firstmap", f.indexedRange.maps.First(), "lastmap", f.indexedRange.maps.Last(),
"head indexed", f.indexedRange.headIndexed) "headindexed", f.indexedRange.headIndexed)
} }
return f return f, nil
} }
// Start starts the indexer. // Start starts the indexer.
@ -399,7 +403,7 @@ func (f *FilterMaps) init() error {
batch := f.db.NewBatch() batch := f.db.NewBatch()
for epoch := range bestLen { for epoch := range bestLen {
cp := checkpoints[bestIdx][epoch] cp := checkpoints[bestIdx][epoch]
f.storeLastBlockOfMap(batch, (uint32(epoch+1)<<f.logMapsPerEpoch)-1, cp.BlockNumber, cp.BlockId) f.storeLastBlockOfMap(batch, f.lastEpochMap(uint32(epoch)), cp.BlockNumber, cp.BlockId)
f.storeBlockLvPointer(batch, cp.BlockNumber, cp.FirstIndex) f.storeBlockLvPointer(batch, cp.BlockNumber, cp.FirstIndex)
} }
fmr := filterMapsRange{ fmr := filterMapsRange{
@ -408,7 +412,7 @@ func (f *FilterMaps) init() error {
if bestLen > 0 { if bestLen > 0 {
cp := checkpoints[bestIdx][bestLen-1] cp := checkpoints[bestIdx][bestLen-1]
fmr.blocks = common.NewRange(cp.BlockNumber+1, 0) fmr.blocks = common.NewRange(cp.BlockNumber+1, 0)
fmr.maps = common.NewRange(uint32(bestLen)<<f.logMapsPerEpoch, 0) fmr.maps = common.NewRange(f.firstEpochMap(uint32(bestLen)), 0)
} }
f.setRange(batch, f.targetView, fmr, false) f.setRange(batch, f.targetView, fmr, false)
return batch.Write() return batch.Write()
@ -578,9 +582,11 @@ func (f *FilterMaps) getFilterMapRows(mapIndices []uint32, rowIndex uint32, base
rows := make([]FilterRow, len(mapIndices)) rows := make([]FilterRow, len(mapIndices))
var ptr int var ptr int
for len(mapIndices) > ptr { for len(mapIndices) > ptr {
baseRowGroup := mapIndices[ptr] / f.baseRowGroupLength var (
groupLength := 1 groupIndex = f.mapGroupIndex(mapIndices[ptr])
for ptr+groupLength < len(mapIndices) && mapIndices[ptr+groupLength]/f.baseRowGroupLength == baseRowGroup { groupLength = 1
)
for ptr+groupLength < len(mapIndices) && f.mapGroupIndex(mapIndices[ptr+groupLength]) == groupIndex {
groupLength++ groupLength++
} }
if err := f.getFilterMapRowsOfGroup(rows[ptr:ptr+groupLength], mapIndices[ptr:ptr+groupLength], rowIndex, baseLayerOnly); err != nil { if err := f.getFilterMapRowsOfGroup(rows[ptr:ptr+groupLength], mapIndices[ptr:ptr+groupLength], rowIndex, baseLayerOnly); err != nil {
@ -594,17 +600,19 @@ func (f *FilterMaps) getFilterMapRows(mapIndices []uint32, rowIndex uint32, base
// getFilterMapRowsOfGroup fetches a set of filter map rows at map indices // getFilterMapRowsOfGroup fetches a set of filter map rows at map indices
// belonging to the same base row group. // belonging to the same base row group.
func (f *FilterMaps) getFilterMapRowsOfGroup(target []FilterRow, mapIndices []uint32, rowIndex uint32, baseLayerOnly bool) error { func (f *FilterMaps) getFilterMapRowsOfGroup(target []FilterRow, mapIndices []uint32, rowIndex uint32, baseLayerOnly bool) error {
baseRowGroup := mapIndices[0] / f.baseRowGroupLength var (
baseMapRowIndex := f.mapRowIndex(baseRowGroup*f.baseRowGroupLength, rowIndex) groupIndex = f.mapGroupIndex(mapIndices[0])
baseRows, err := rawdb.ReadFilterMapBaseRows(f.db, baseMapRowIndex, f.baseRowGroupLength, f.logMapWidth) mapRowIndex = f.mapRowIndex(groupIndex, rowIndex)
)
baseRows, err := rawdb.ReadFilterMapBaseRows(f.db, mapRowIndex, f.baseRowGroupSize, f.logMapWidth)
if err != nil { if err != nil {
return fmt.Errorf("failed to retrieve base row group %d of row %d: %v", baseRowGroup, rowIndex, err) return fmt.Errorf("failed to retrieve base row group %d of row %d: %v", groupIndex, rowIndex, err)
} }
for i, mapIndex := range mapIndices { for i, mapIndex := range mapIndices {
if mapIndex/f.baseRowGroupLength != baseRowGroup { if f.mapGroupIndex(mapIndex) != groupIndex {
panic("mapIndices are not in the same base row group") return fmt.Errorf("maps are not in the same base row group, index: %d, group: %d", mapIndex, groupIndex)
} }
row := baseRows[mapIndex&(f.baseRowGroupLength-1)] row := baseRows[f.mapGroupOffset(mapIndex)]
if !baseLayerOnly { if !baseLayerOnly {
extRow, err := rawdb.ReadFilterMapExtRow(f.db, f.mapRowIndex(mapIndex, rowIndex), f.logMapWidth) extRow, err := rawdb.ReadFilterMapExtRow(f.db, f.mapRowIndex(mapIndex, rowIndex), f.logMapWidth)
if err != nil { if err != nil {
@ -621,15 +629,17 @@ func (f *FilterMaps) getFilterMapRowsOfGroup(target []FilterRow, mapIndices []ui
// indices and a shared row index. // indices and a shared row index.
func (f *FilterMaps) storeFilterMapRows(batch ethdb.Batch, mapIndices []uint32, rowIndex uint32, rows []FilterRow) error { func (f *FilterMaps) storeFilterMapRows(batch ethdb.Batch, mapIndices []uint32, rowIndex uint32, rows []FilterRow) error {
for len(mapIndices) > 0 { for len(mapIndices) > 0 {
baseRowGroup := mapIndices[0] / f.baseRowGroupLength var (
groupLength := 1 pos = 1
for groupLength < len(mapIndices) && mapIndices[groupLength]/f.baseRowGroupLength == baseRowGroup { groupIndex = f.mapGroupIndex(mapIndices[0])
groupLength++ )
for pos < len(mapIndices) && f.mapGroupIndex(mapIndices[pos]) == groupIndex {
pos++
} }
if err := f.storeFilterMapRowsOfGroup(batch, mapIndices[:groupLength], rowIndex, rows[:groupLength]); err != nil { if err := f.storeFilterMapRowsOfGroup(batch, mapIndices[:pos], rowIndex, rows[:pos]); err != nil {
return err return err
} }
mapIndices, rows = mapIndices[groupLength:], rows[groupLength:] mapIndices, rows = mapIndices[pos:], rows[pos:]
} }
return nil return nil
} }
@ -637,21 +647,23 @@ func (f *FilterMaps) storeFilterMapRows(batch ethdb.Batch, mapIndices []uint32,
// storeFilterMapRowsOfGroup stores a set of filter map rows at map indices // storeFilterMapRowsOfGroup stores a set of filter map rows at map indices
// belonging to the same base row group. // belonging to the same base row group.
func (f *FilterMaps) storeFilterMapRowsOfGroup(batch ethdb.Batch, mapIndices []uint32, rowIndex uint32, rows []FilterRow) error { func (f *FilterMaps) storeFilterMapRowsOfGroup(batch ethdb.Batch, mapIndices []uint32, rowIndex uint32, rows []FilterRow) error {
baseRowGroup := mapIndices[0] / f.baseRowGroupLength var (
baseMapRowIndex := f.mapRowIndex(baseRowGroup*f.baseRowGroupLength, rowIndex) baseRows [][]uint32
var baseRows [][]uint32 groupIndex = f.mapGroupIndex(mapIndices[0])
if uint32(len(mapIndices)) != f.baseRowGroupLength { // skip base rows read if all rows are replaced mapRowIndex = f.mapRowIndex(groupIndex, rowIndex)
)
if uint32(len(mapIndices)) != f.baseRowGroupSize { // skip base rows read if all rows are replaced
var err error var err error
baseRows, err = rawdb.ReadFilterMapBaseRows(f.db, baseMapRowIndex, f.baseRowGroupLength, f.logMapWidth) baseRows, err = rawdb.ReadFilterMapBaseRows(f.db, mapRowIndex, f.baseRowGroupSize, f.logMapWidth)
if err != nil { if err != nil {
return fmt.Errorf("failed to retrieve base row group %d of row %d for modification: %v", baseRowGroup, rowIndex, err) return fmt.Errorf("failed to retrieve filter map %d base rows %d for modification: %v", groupIndex, rowIndex, err)
} }
} else { } else {
baseRows = make([][]uint32, f.baseRowGroupLength) baseRows = make([][]uint32, f.baseRowGroupSize)
} }
for i, mapIndex := range mapIndices { for i, mapIndex := range mapIndices {
if mapIndex/f.baseRowGroupLength != baseRowGroup { if f.mapGroupIndex(mapIndex) != groupIndex {
panic("mapIndices are not in the same base row group") return fmt.Errorf("maps are not in the same base row group, index: %d, group: %d", mapIndex, groupIndex)
} }
baseRow := []uint32(rows[i]) baseRow := []uint32(rows[i])
var extRow FilterRow var extRow FilterRow
@ -659,10 +671,10 @@ func (f *FilterMaps) storeFilterMapRowsOfGroup(batch ethdb.Batch, mapIndices []u
extRow = baseRow[f.baseRowLength:] extRow = baseRow[f.baseRowLength:]
baseRow = baseRow[:f.baseRowLength] baseRow = baseRow[:f.baseRowLength]
} }
baseRows[mapIndex&(f.baseRowGroupLength-1)] = baseRow baseRows[f.mapGroupOffset(mapIndex)] = baseRow
rawdb.WriteFilterMapExtRow(batch, f.mapRowIndex(mapIndex, rowIndex), extRow, f.logMapWidth) rawdb.WriteFilterMapExtRow(batch, f.mapRowIndex(mapIndex, rowIndex), extRow, f.logMapWidth)
} }
rawdb.WriteFilterMapBaseRows(batch, baseMapRowIndex, baseRows, f.logMapWidth) rawdb.WriteFilterMapBaseRows(batch, mapRowIndex, baseRows, f.logMapWidth)
return nil return nil
} }
@ -747,12 +759,12 @@ func (f *FilterMaps) deleteTailEpoch(epoch uint32) (bool, error) {
defer f.indexLock.Unlock() defer f.indexLock.Unlock()
// determine epoch boundaries // determine epoch boundaries
firstMap := epoch << f.logMapsPerEpoch lastBlock, _, err := f.getLastBlockOfMap(f.lastEpochMap(epoch))
lastBlock, _, err := f.getLastBlockOfMap(firstMap + f.mapsPerEpoch - 1)
if err != nil { if err != nil {
return false, fmt.Errorf("failed to retrieve last block of deleted epoch %d: %v", epoch, err) return false, fmt.Errorf("failed to retrieve last block of deleted epoch %d: %v", epoch, err)
} }
var firstBlock uint64 var firstBlock uint64
firstMap := f.firstEpochMap(epoch)
if epoch > 0 { if epoch > 0 {
firstBlock, _, err = f.getLastBlockOfMap(firstMap - 1) firstBlock, _, err = f.getLastBlockOfMap(firstMap - 1)
if err != nil { if err != nil {
@ -763,8 +775,8 @@ func (f *FilterMaps) deleteTailEpoch(epoch uint32) (bool, error) {
// update rendered range if necessary // update rendered range if necessary
var ( var (
fmr = f.indexedRange fmr = f.indexedRange
firstEpoch = f.indexedRange.maps.First() >> f.logMapsPerEpoch firstEpoch = f.mapEpoch(f.indexedRange.maps.First())
afterLastEpoch = (f.indexedRange.maps.AfterLast() + f.mapsPerEpoch - 1) >> f.logMapsPerEpoch afterLastEpoch = f.mapEpoch(f.indexedRange.maps.AfterLast() + f.mapsPerEpoch - 1)
) )
if f.indexedRange.tailPartialEpoch != 0 && firstEpoch > 0 { if f.indexedRange.tailPartialEpoch != 0 && firstEpoch > 0 {
firstEpoch-- firstEpoch--
@ -776,7 +788,7 @@ func (f *FilterMaps) deleteTailEpoch(epoch uint32) (bool, error) {
// first fully or partially rendered epoch and there is at least one // first fully or partially rendered epoch and there is at least one
// rendered map in the next epoch; remove from indexed range // rendered map in the next epoch; remove from indexed range
fmr.tailPartialEpoch = 0 fmr.tailPartialEpoch = 0
fmr.maps.SetFirst((epoch + 1) << f.logMapsPerEpoch) fmr.maps.SetFirst(f.firstEpochMap(epoch + 1))
fmr.blocks.SetFirst(lastBlock + 1) fmr.blocks.SetFirst(lastBlock + 1)
f.setRange(f.db, f.indexedView, fmr, false) f.setRange(f.db, f.indexedView, fmr, false)
default: default:
@ -857,7 +869,7 @@ func (f *FilterMaps) exportCheckpoints() {
w.WriteString("[\n") w.WriteString("[\n")
comma := "," comma := ","
for epoch := uint32(0); epoch < epochCount; epoch++ { for epoch := uint32(0); epoch < epochCount; epoch++ {
lastBlock, lastBlockId, err := f.getLastBlockOfMap((epoch+1)<<f.logMapsPerEpoch - 1) lastBlock, lastBlockId, err := f.getLastBlockOfMap(f.lastEpochMap(epoch))
if err != nil { if err != nil {
log.Error("Error fetching last block of epoch", "epoch", epoch, "error", err) log.Error("Error fetching last block of epoch", "epoch", epoch, "error", err)
return return

View file

@ -281,7 +281,7 @@ func (f *FilterMaps) tryIndexHead() error {
// is changed. // is changed.
func (f *FilterMaps) tryIndexTail() (bool, error) { func (f *FilterMaps) tryIndexTail() (bool, error) {
for { for {
firstEpoch := f.indexedRange.maps.First() >> f.logMapsPerEpoch firstEpoch := f.mapEpoch(f.indexedRange.maps.First())
if firstEpoch == 0 || !f.needTailEpoch(firstEpoch-1) { if firstEpoch == 0 || !f.needTailEpoch(firstEpoch-1) {
break break
} }
@ -359,7 +359,7 @@ func (f *FilterMaps) tryIndexTail() (bool, error) {
// Note that unindexing is very quick as it only removes continuous ranges of // Note that unindexing is very quick as it only removes continuous ranges of
// data from the database and is also called while running head indexing. // data from the database and is also called while running head indexing.
func (f *FilterMaps) tryUnindexTail() (bool, error) { func (f *FilterMaps) tryUnindexTail() (bool, error) {
firstEpoch := f.indexedRange.maps.First() >> f.logMapsPerEpoch firstEpoch := f.mapEpoch(f.indexedRange.maps.First())
if f.indexedRange.tailPartialEpoch > 0 && firstEpoch > 0 { if f.indexedRange.tailPartialEpoch > 0 && firstEpoch > 0 {
firstEpoch-- firstEpoch--
} }
@ -380,9 +380,9 @@ func (f *FilterMaps) tryUnindexTail() (bool, error) {
} }
if f.startedTailUnindex && f.indexedRange.hasIndexedBlocks() { if f.startedTailUnindex && f.indexedRange.hasIndexedBlocks() {
log.Info("Log index tail unindexing finished", log.Info("Log index tail unindexing finished",
"first block", f.indexedRange.blocks.First(), "last block", f.indexedRange.blocks.Last(), "firstblock", f.indexedRange.blocks.First(), "lastblock", f.indexedRange.blocks.Last(),
"removed maps", f.indexedRange.maps.First()-f.ptrTailUnindexMap, "removedmaps", f.indexedRange.maps.First()-f.ptrTailUnindexMap,
"removed blocks", f.indexedRange.blocks.First()-f.tailPartialBlocks()-f.ptrTailUnindexBlock, "removedblocks", f.indexedRange.blocks.First()-f.tailPartialBlocks()-f.ptrTailUnindexBlock,
"elapsed", common.PrettyDuration(time.Since(f.startedTailUnindexAt))) "elapsed", common.PrettyDuration(time.Since(f.startedTailUnindexAt)))
f.startedTailUnindex = false f.startedTailUnindex = false
} }
@ -392,11 +392,11 @@ func (f *FilterMaps) tryUnindexTail() (bool, error) {
// needTailEpoch returns true if the given tail epoch needs to be kept // needTailEpoch returns true if the given tail epoch needs to be kept
// according to the current tail target, false if it can be removed. // according to the current tail target, false if it can be removed.
func (f *FilterMaps) needTailEpoch(epoch uint32) bool { func (f *FilterMaps) needTailEpoch(epoch uint32) bool {
firstEpoch := f.indexedRange.maps.First() >> f.logMapsPerEpoch firstEpoch := f.mapEpoch(f.indexedRange.maps.First())
if epoch > firstEpoch { if epoch > firstEpoch {
return true return true
} }
if (epoch+1)<<f.logMapsPerEpoch >= f.indexedRange.maps.AfterLast() { if f.firstEpochMap(epoch+1) >= f.indexedRange.maps.AfterLast() {
return true return true
} }
if epoch+1 < firstEpoch { if epoch+1 < firstEpoch {
@ -405,7 +405,7 @@ func (f *FilterMaps) needTailEpoch(epoch uint32) bool {
var lastBlockOfPrevEpoch uint64 var lastBlockOfPrevEpoch uint64
if epoch > 0 { if epoch > 0 {
var err error var err error
lastBlockOfPrevEpoch, _, err = f.getLastBlockOfMap(epoch<<f.logMapsPerEpoch - 1) lastBlockOfPrevEpoch, _, err = f.getLastBlockOfMap(f.lastEpochMap(epoch - 1))
if err != nil { if err != nil {
log.Error("Could not get last block of previous epoch", "epoch", epoch-1, "error", err) log.Error("Could not get last block of previous epoch", "epoch", epoch-1, "error", err)
return epoch >= firstEpoch return epoch >= firstEpoch
@ -414,7 +414,7 @@ func (f *FilterMaps) needTailEpoch(epoch uint32) bool {
if f.historyCutoff > lastBlockOfPrevEpoch { if f.historyCutoff > lastBlockOfPrevEpoch {
return false return false
} }
lastBlockOfEpoch, _, err := f.getLastBlockOfMap((epoch+1)<<f.logMapsPerEpoch - 1) lastBlockOfEpoch, _, err := f.getLastBlockOfMap(f.lastEpochMap(epoch))
if err != nil { if err != nil {
log.Error("Could not get last block of epoch", "epoch", epoch, "error", err) log.Error("Could not get last block of epoch", "epoch", epoch, "error", err)
return epoch >= firstEpoch return epoch >= firstEpoch

View file

@ -41,7 +41,7 @@ var testParams = Params{
logMapWidth: 24, logMapWidth: 24,
logMapsPerEpoch: 4, logMapsPerEpoch: 4,
logValuesPerMap: 4, logValuesPerMap: 4,
baseRowGroupLength: 4, baseRowGroupSize: 4,
baseRowLengthRatio: 2, baseRowLengthRatio: 2,
logLayerDiff: 2, logLayerDiff: 2,
} }
@ -370,7 +370,7 @@ func (ts *testSetup) setHistory(history uint64, noHistory bool) {
History: history, History: history,
Disabled: noHistory, Disabled: noHistory,
} }
ts.fm = NewFilterMaps(ts.db, view, 0, 0, ts.params, config) ts.fm, _ = NewFilterMaps(ts.db, view, 0, 0, ts.params, config)
ts.fm.testDisableSnapshots = ts.testDisableSnapshots ts.fm.testDisableSnapshots = ts.testDisableSnapshots
ts.fm.Start() ts.fm.Start()
} }

View file

@ -284,7 +284,7 @@ func (r *mapRenderer) run(stopCb func() bool, writeCb func()) (bool, error) {
// map finished // map finished
r.finishedMaps[r.currentMap.mapIndex] = r.currentMap r.finishedMaps[r.currentMap.mapIndex] = r.currentMap
r.finished.SetLast(r.finished.AfterLast()) r.finished.SetLast(r.finished.AfterLast())
if len(r.finishedMaps) >= maxMapsPerBatch || r.finished.AfterLast()&(r.f.baseRowGroupLength-1) == 0 { if len(r.finishedMaps) >= maxMapsPerBatch || r.f.mapGroupOffset(r.finished.AfterLast()) == 0 {
if err := r.writeFinishedMaps(stopCb); err != nil { if err := r.writeFinishedMaps(stopCb); err != nil {
return false, err return false, err
} }

View file

@ -844,7 +844,7 @@ func (m *matchSequenceInstance) dropNext(mapIndex uint32) bool {
// results at mapIndex and mapIndex+1. Note that acquiring nextNextRes may be // results at mapIndex and mapIndex+1. Note that acquiring nextNextRes may be
// skipped and it can be substituted with an empty list if baseRes has no potential // skipped and it can be substituted with an empty list if baseRes has no potential
// matches that could be sequence matched with anything that could be in nextNextRes. // matches that could be sequence matched with anything that could be in nextNextRes.
func (params *Params) matchResults(mapIndex uint32, offset uint64, baseRes, nextRes potentialMatches) potentialMatches { func (p *Params) matchResults(mapIndex uint32, offset uint64, baseRes, nextRes potentialMatches) potentialMatches {
if nextRes == nil || (baseRes != nil && len(baseRes) == 0) { if nextRes == nil || (baseRes != nil && len(baseRes) == 0) {
// if nextRes is a wild card or baseRes is empty then the sequence matcher // if nextRes is a wild card or baseRes is empty then the sequence matcher
// result equals baseRes. // result equals baseRes.
@ -854,7 +854,7 @@ func (params *Params) matchResults(mapIndex uint32, offset uint64, baseRes, next
// if baseRes is a wild card or nextRes is empty then the sequence matcher // if baseRes is a wild card or nextRes is empty then the sequence matcher
// result is the items of nextRes with a negative offset applied. // result is the items of nextRes with a negative offset applied.
result := make(potentialMatches, 0, len(nextRes)) result := make(potentialMatches, 0, len(nextRes))
min := (uint64(mapIndex) << params.logValuesPerMap) + offset min := (uint64(mapIndex) << p.logValuesPerMap) + offset
for _, v := range nextRes { for _, v := range nextRes {
if v >= min { if v >= min {
result = append(result, v-offset) result = append(result, v-offset)

View file

@ -19,6 +19,7 @@ package filtermaps
import ( import (
"crypto/sha256" "crypto/sha256"
"encoding/binary" "encoding/binary"
"fmt"
"hash/fnv" "hash/fnv"
"math" "math"
"sort" "sort"
@ -28,19 +29,36 @@ import (
// Params defines the basic parameters of the log index structure. // Params defines the basic parameters of the log index structure.
type Params struct { type Params struct {
logMapHeight uint // log2(mapHeight) logMapHeight uint // The number of bits required to represent the map height
logMapWidth uint // log2(mapWidth) logMapWidth uint // The number of bits required to represent the map width
logMapsPerEpoch uint // log2(mapsPerEpoch) logMapsPerEpoch uint // The number of bits required to represent the number of maps per epoch
logValuesPerMap uint // log2(logValuesPerMap) logValuesPerMap uint // The number of bits required to represent the number of log values per map
baseRowLengthRatio uint // baseRowLength / average row length
logLayerDiff uint // maxRowLength log2 growth per layer // baseRowLengthRatio represents the ratio of base row length
// derived fields // to the average row length.
mapHeight uint32 // filter map height (number of rows) baseRowLengthRatio uint
mapsPerEpoch uint32 // number of maps in an epoch
// logLayerDiff defines the logarithmic growth factor (base 2) of
// the maximum row length per layer. It indicates how much the maximum
// row length increases as the layer depth increases.
//
// Specifically:
// - the row length in base layer (layer == 0) is baseRowLength
// - the row length in layer x is baseRowLength << (logLayerDiff * x)
logLayerDiff uint
// These fields can be derived with the information above
mapHeight uint32 // The number of rows in the filter map
mapsPerEpoch uint32 // The number of maps in an epoch
valuesPerMap uint64 // The number of log values marked on each filter map
baseRowLength uint32 // maximum number of log values per row on layer 0 baseRowLength uint32 // maximum number of log values per row on layer 0
valuesPerMap uint64 // number of log values marked on each filter map
// not affecting consensus // baseRowGroupSize defines the number of base row entries grouped together
baseRowGroupLength uint32 // length of base row groups in local database // as a single database entry in the local database to optimize storage
// and retrieval efficiency.
//
// This value can be configured based on the specific implementation.
baseRowGroupSize uint32
} }
// DefaultParams is the set of parameters used on mainnet. // DefaultParams is the set of parameters used on mainnet.
@ -49,7 +67,7 @@ var DefaultParams = Params{
logMapWidth: 24, logMapWidth: 24,
logMapsPerEpoch: 10, logMapsPerEpoch: 10,
logValuesPerMap: 16, logValuesPerMap: 16,
baseRowGroupLength: 32, baseRowGroupSize: 32,
baseRowLengthRatio: 8, baseRowLengthRatio: 8,
logLayerDiff: 4, logLayerDiff: 4,
} }
@ -60,7 +78,7 @@ var RangeTestParams = Params{
logMapWidth: 24, logMapWidth: 24,
logMapsPerEpoch: 0, logMapsPerEpoch: 0,
logValuesPerMap: 0, logValuesPerMap: 0,
baseRowGroupLength: 32, baseRowGroupSize: 32,
baseRowLengthRatio: 16, // baseRowLength >= 1 baseRowLengthRatio: 16, // baseRowLength >= 1
logLayerDiff: 4, logLayerDiff: 4,
} }
@ -91,6 +109,44 @@ func topicValue(topic common.Hash) common.Hash {
return result return result
} }
// sanitize derives any missing fields and validates the parameter values.
func (p *Params) sanitize() error {
p.deriveFields()
if p.logMapWidth%8 != 0 {
return fmt.Errorf("invalid configuration: logMapWidth (%d) must be a multiple of 8", p.logMapWidth)
}
if p.baseRowGroupSize == 0 || (p.baseRowGroupSize&(p.baseRowGroupSize-1)) != 0 {
return fmt.Errorf("invalid configuration: baseRowGroupSize (%d) must be a power of 2", p.baseRowGroupSize)
}
return nil
}
// mapGroupIndex returns the start index of the base row group that contains the
// given map index. Assumes baseRowGroupSize is a power of 2.
func (p *Params) mapGroupIndex(index uint32) uint32 {
return index & ^(p.baseRowGroupSize - 1)
}
// mapGroupOffset returns the offset of the given map index within its base row group.
func (p *Params) mapGroupOffset(index uint32) uint32 {
return index & (p.baseRowGroupSize - 1)
}
// mapEpoch returns the epoch number that the given map index belongs to.
func (p *Params) mapEpoch(index uint32) uint32 {
return index >> p.logMapsPerEpoch
}
// firstEpochMap returns the index of the first map in the specified epoch.
func (p *Params) firstEpochMap(epoch uint32) uint32 {
return epoch << p.logMapsPerEpoch
}
// lastEpochMap returns the index of the last map in the specified epoch.
func (p *Params) lastEpochMap(epoch uint32) uint32 {
return (epoch+1)<<p.logMapsPerEpoch - 1
}
// rowIndex returns the row index in which the given log value should be marked // rowIndex returns the row index in which the given log value should be marked
// on the given map and mapping layer. Note that row assignments are re-shuffled // on the given map and mapping layer. Note that row assignments are re-shuffled
// with a different frequency on each mapping layer, allowing efficient disk // with a different frequency on each mapping layer, allowing efficient disk
@ -125,17 +181,20 @@ func (p *Params) columnIndex(lvIndex uint64, logValue *common.Hash) uint32 {
return uint32(lvIndex%p.valuesPerMap)<<hashBits + (uint32(hash>>(64-hashBits)) ^ uint32(hash)>>(32-hashBits)) return uint32(lvIndex%p.valuesPerMap)<<hashBits + (uint32(hash>>(64-hashBits)) ^ uint32(hash)>>(32-hashBits))
} }
// maxRowLength returns the maximum length filter rows are populated up to // maxRowLength returns the maximum length filter rows are populated up to when
// when using the given mapping layer. A log value can be marked on the map // using the given mapping layer.
// according to a given mapping layer if the row mapping on that layer points //
// to a row that has not yet reached the maxRowLength belonging to that layer. // A log value can be marked on the map according to a given mapping layer if
// the row mapping on that layer points to a row that has not yet reached the
// maxRowLength belonging to that layer.
//
// This means that a row that is considered full on a given layer may still be // This means that a row that is considered full on a given layer may still be
// extended further on a higher order layer. // extended further on a higher order layer.
//
// Each value is marked on the lowest order layer possible, assuming that marks // Each value is marked on the lowest order layer possible, assuming that marks
// are added in ascending log value index order. // are added in ascending log value index order. When searching for a log value
// When searching for a log value one should consider all layers and process // one should consider all layers and process corresponding rows up until the
// corresponding rows up until the first one where the row mapped to the given // first one where the row mapped to the given layer is not full.
// layer is not full.
func (p *Params) maxRowLength(layerIndex uint32) uint32 { func (p *Params) maxRowLength(layerIndex uint32) uint32 {
logLayerDiff := uint(layerIndex) * p.logLayerDiff logLayerDiff := uint(layerIndex) * p.logLayerDiff
if logLayerDiff > p.logMapsPerEpoch { if logLayerDiff > p.logMapsPerEpoch {

View file

@ -97,15 +97,15 @@ func NewHeaderChain(chainDb ethdb.Database, config *params.ChainConfig, engine c
// GetBlockNumber retrieves the block number belonging to the given hash // GetBlockNumber retrieves the block number belonging to the given hash
// from the cache or database // from the cache or database
func (hc *HeaderChain) GetBlockNumber(hash common.Hash) *uint64 { func (hc *HeaderChain) GetBlockNumber(hash common.Hash) (uint64, bool) {
if cached, ok := hc.numberCache.Get(hash); ok { if cached, ok := hc.numberCache.Get(hash); ok {
return &cached return cached, true
} }
number := rawdb.ReadHeaderNumber(hc.chainDb, hash) number, ok := rawdb.ReadHeaderNumber(hc.chainDb, hash)
if number != nil { if ok {
hc.numberCache.Add(hash, *number) hc.numberCache.Add(hash, number)
} }
return number return number, ok
} }
type headerWriteResult struct { type headerWriteResult struct {
@ -402,11 +402,11 @@ func (hc *HeaderChain) GetHeader(hash common.Hash, number uint64) *types.Header
// GetHeaderByHash retrieves a block header from the database by hash, caching it if // GetHeaderByHash retrieves a block header from the database by hash, caching it if
// found. // found.
func (hc *HeaderChain) GetHeaderByHash(hash common.Hash) *types.Header { func (hc *HeaderChain) GetHeaderByHash(hash common.Hash) *types.Header {
number := hc.GetBlockNumber(hash) number, ok := hc.GetBlockNumber(hash)
if number == nil { if !ok {
return nil return nil
} }
return hc.GetHeader(hash, *number) return hc.GetHeader(hash, number)
} }
// HasHeader checks if a block header is present in the database or not. // HasHeader checks if a block header is present in the database or not.

View file

@ -0,0 +1,105 @@
// Copyright 2025 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package overlay
import (
"bytes"
"encoding/gob"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
)
// TransitionState is a structure that holds the progress markers of the
// translation process.
type TransitionState struct {
CurrentAccountAddress *common.Address // addresss of the last translated account
CurrentSlotHash common.Hash // hash of the last translated storage slot
CurrentPreimageOffset int64 // next byte to read from the preimage file
Started, Ended bool
// Mark whether the storage for an account has been processed. This is useful if the
// maximum number of leaves of the conversion is reached before the whole storage is
// processed.
StorageProcessed bool
BaseRoot common.Hash // hash of the last read-only MPT base tree
}
// InTransition returns true if the translation process is in progress.
func (ts *TransitionState) InTransition() bool {
return ts != nil && ts.Started && !ts.Ended
}
// Transitioned returns true if the translation process has been completed.
func (ts *TransitionState) Transitioned() bool {
return ts != nil && ts.Ended
}
// Copy returns a deep copy of the TransitionState object.
func (ts *TransitionState) Copy() *TransitionState {
ret := &TransitionState{
Started: ts.Started,
Ended: ts.Ended,
CurrentSlotHash: ts.CurrentSlotHash,
CurrentPreimageOffset: ts.CurrentPreimageOffset,
StorageProcessed: ts.StorageProcessed,
}
if ts.CurrentAccountAddress != nil {
addr := *ts.CurrentAccountAddress
ret.CurrentAccountAddress = &addr
}
return ret
}
// LoadTransitionState retrieves the Verkle transition state associated with
// the given state root hash from the database.
func LoadTransitionState(db ethdb.KeyValueReader, root common.Hash, isVerkle bool) *TransitionState {
var ts *TransitionState
data, _ := rawdb.ReadVerkleTransitionState(db, root)
// if a state could be read from the db, attempt to decode it
if len(data) > 0 {
var (
newts TransitionState
buf = bytes.NewBuffer(data[:])
dec = gob.NewDecoder(buf)
)
// Decode transition state
err := dec.Decode(&newts)
if err != nil {
log.Error("failed to decode transition state", "err", err)
return nil
}
ts = &newts
}
// Fallback that should only happen before the transition
if ts == nil {
// Initialize the first transition state, with the "ended"
// field set to true if the database was created
// as a verkle database.
log.Debug("no transition state found, starting fresh", "is verkle", db)
// Start with a fresh state
ts = &TransitionState{Ended: isVerkle}
}
return ts
}

View file

@ -143,13 +143,13 @@ func ReadAllCanonicalHashes(db ethdb.Iteratee, from uint64, to uint64, limit int
} }
// ReadHeaderNumber returns the header number assigned to a hash. // ReadHeaderNumber returns the header number assigned to a hash.
func ReadHeaderNumber(db ethdb.KeyValueReader, hash common.Hash) *uint64 { func ReadHeaderNumber(db ethdb.KeyValueReader, hash common.Hash) (uint64, bool) {
data, _ := db.Get(headerNumberKey(hash)) data, _ := db.Get(headerNumberKey(hash))
if len(data) != 8 { if len(data) != 8 {
return nil return 0, false
} }
number := binary.BigEndian.Uint64(data) number := binary.BigEndian.Uint64(data)
return &number return number, true
} }
// WriteHeaderNumber stores the hash->number mapping. // WriteHeaderNumber stores the hash->number mapping.
@ -449,9 +449,10 @@ func ReadBodyRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue
return data return data
} }
// ReadCanonicalBodyRLP retrieves the block body (transactions and uncles) for the canonical // ReadCanonicalBodyRLP retrieves the block body (transactions and uncles) for the
// block at number, in RLP encoding. // canonical block at number, in RLP encoding. Optionally it takes the block hash
func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64) rlp.RawValue { // to avoid looking it up
func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64, hash *common.Hash) rlp.RawValue {
var data []byte var data []byte
db.ReadAncients(func(reader ethdb.AncientReaderOp) error { db.ReadAncients(func(reader ethdb.AncientReaderOp) error {
data, _ = reader.Ancient(ChainFreezerBodiesTable, number) data, _ = reader.Ancient(ChainFreezerBodiesTable, number)
@ -459,10 +460,14 @@ func ReadCanonicalBodyRLP(db ethdb.Reader, number uint64) rlp.RawValue {
return nil return nil
} }
// Block is not in ancients, read from leveldb by hash and number. // Block is not in ancients, read from leveldb by hash and number.
// Note: ReadCanonicalHash cannot be used here because it also if hash != nil {
// calls ReadAncients internally. data, _ = db.Get(blockBodyKey(number, *hash))
hash, _ := db.Get(headerHashKey(number)) } else {
data, _ = db.Get(blockBodyKey(number, common.BytesToHash(hash))) // Note: ReadCanonicalHash cannot be used here because it also
// calls ReadAncients internally.
hashBytes, _ := db.Get(headerHashKey(number))
data, _ = db.Get(blockBodyKey(number, common.BytesToHash(hashBytes)))
}
return nil return nil
}) })
return data return data
@ -544,6 +549,29 @@ func ReadReceiptsRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawVa
return data return data
} }
// ReadCanonicalReceiptsRLP retrieves the receipts RLP for the canonical block at
// number, in RLP encoding. Optionally it takes the block hash to avoid looking it up.
func ReadCanonicalReceiptsRLP(db ethdb.Reader, number uint64, hash *common.Hash) rlp.RawValue {
var data []byte
db.ReadAncients(func(reader ethdb.AncientReaderOp) error {
data, _ = reader.Ancient(ChainFreezerReceiptTable, number)
if len(data) > 0 {
return nil
}
// Block is not in ancients, read from leveldb by hash and number.
if hash != nil {
data, _ = db.Get(blockReceiptsKey(number, *hash))
} else {
// Note: ReadCanonicalHash cannot be used here because it also
// calls ReadAncients internally.
hashBytes, _ := db.Get(headerHashKey(number))
data, _ = db.Get(blockReceiptsKey(number, common.BytesToHash(hashBytes)))
}
return nil
})
return data
}
// ReadRawReceipts retrieves all the transaction receipts belonging to a block. // ReadRawReceipts retrieves all the transaction receipts belonging to a block.
// The receipt metadata fields and the Bloom are not guaranteed to be populated, // The receipt metadata fields and the Bloom are not guaranteed to be populated,
// so they should not be used. Use ReadReceipts instead if the metadata is needed. // so they should not be used. Use ReadReceipts instead if the metadata is needed.
@ -907,11 +935,11 @@ func ReadHeadHeader(db ethdb.Reader) *types.Header {
if headHeaderHash == (common.Hash{}) { if headHeaderHash == (common.Hash{}) {
return nil return nil
} }
headHeaderNumber := ReadHeaderNumber(db, headHeaderHash) headHeaderNumber, ok := ReadHeaderNumber(db, headHeaderHash)
if headHeaderNumber == nil { if !ok {
return nil return nil
} }
return ReadHeader(db, headHeaderHash, *headHeaderNumber) return ReadHeader(db, headHeaderHash, headHeaderNumber)
} }
// ReadHeadBlock returns the current canonical head block. // ReadHeadBlock returns the current canonical head block.
@ -920,9 +948,9 @@ func ReadHeadBlock(db ethdb.Reader) *types.Block {
if headBlockHash == (common.Hash{}) { if headBlockHash == (common.Hash{}) {
return nil return nil
} }
headBlockNumber := ReadHeaderNumber(db, headBlockHash) headBlockNumber, ok := ReadHeaderNumber(db, headBlockHash)
if headBlockNumber == nil { if !ok {
return nil return nil
} }
return ReadBlock(db, headBlockHash, *headBlockNumber) return ReadBlock(db, headBlockHash, headBlockNumber)
} }

View file

@ -441,6 +441,9 @@ func TestAncientStorage(t *testing.T) {
if blob := ReadReceiptsRLP(db, hash, number); len(blob) > 0 { if blob := ReadReceiptsRLP(db, hash, number); len(blob) > 0 {
t.Fatalf("non existent receipts returned") t.Fatalf("non existent receipts returned")
} }
if blob := ReadCanonicalReceiptsRLP(db, number, &hash); len(blob) > 0 {
t.Fatalf("non existent receipts returned")
}
// Write and verify the header in the database // Write and verify the header in the database
WriteAncientBlocks(db, []*types.Block{block}, types.EncodeBlockReceiptLists([]types.Receipts{nil})) WriteAncientBlocks(db, []*types.Block{block}, types.EncodeBlockReceiptLists([]types.Receipts{nil}))
@ -454,6 +457,9 @@ func TestAncientStorage(t *testing.T) {
if blob := ReadReceiptsRLP(db, hash, number); len(blob) == 0 { if blob := ReadReceiptsRLP(db, hash, number); len(blob) == 0 {
t.Fatalf("no receipts returned") t.Fatalf("no receipts returned")
} }
if blob := ReadCanonicalReceiptsRLP(db, number, &hash); len(blob) == 0 {
t.Fatalf("no receipts returned")
}
// Use a fake hash for data retrieval, nothing should be returned. // Use a fake hash for data retrieval, nothing should be returned.
fakeHash := common.BytesToHash([]byte{0x01, 0x02, 0x03}) fakeHash := common.BytesToHash([]byte{0x01, 0x02, 0x03})

View file

@ -20,6 +20,7 @@ import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"errors" "errors"
"fmt"
"math/big" "math/big"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -40,7 +41,11 @@ func DecodeTxLookupEntry(data []byte, db ethdb.Reader) *uint64 {
} }
// Database v4-v5 tx lookup format just stores the hash // Database v4-v5 tx lookup format just stores the hash
if len(data) == common.HashLength { if len(data) == common.HashLength {
return ReadHeaderNumber(db, common.BytesToHash(data)) number, ok := ReadHeaderNumber(db, common.BytesToHash(data))
if !ok {
return nil
}
return &number
} }
// Finally try database v3 tx lookup format // Finally try database v3 tx lookup format
var entry LegacyTxLookupEntry var entry LegacyTxLookupEntry
@ -169,9 +174,10 @@ func findTxInBlockBody(blockbody rlp.RawValue, target common.Hash) (*types.Trans
return nil, 0, errors.New("transaction not found") return nil, 0, errors.New("transaction not found")
} }
// ReadTransaction retrieves a specific transaction from the database, along with // ReadCanonicalTransaction retrieves a specific transaction from the database, along
// its added positional metadata. // with its added positional metadata. Notably, only the transaction in the canonical
func ReadTransaction(db ethdb.Reader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64) { // chain is visible.
func ReadCanonicalTransaction(db ethdb.Reader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64) {
blockNumber := ReadTxLookupEntry(db, hash) blockNumber := ReadTxLookupEntry(db, hash)
if blockNumber == nil { if blockNumber == nil {
return nil, common.Hash{}, 0, 0 return nil, common.Hash{}, 0, 0
@ -180,7 +186,7 @@ func ReadTransaction(db ethdb.Reader, hash common.Hash) (*types.Transaction, com
if blockHash == (common.Hash{}) { if blockHash == (common.Hash{}) {
return nil, common.Hash{}, 0, 0 return nil, common.Hash{}, 0, 0
} }
bodyRLP := ReadBodyRLP(db, blockHash, *blockNumber) bodyRLP := ReadCanonicalBodyRLP(db, *blockNumber, &blockHash)
if bodyRLP == nil { if bodyRLP == nil {
log.Error("Transaction referenced missing", "number", *blockNumber, "hash", blockHash) log.Error("Transaction referenced missing", "number", *blockNumber, "hash", blockHash)
return nil, common.Hash{}, 0, 0 return nil, common.Hash{}, 0, 0
@ -193,9 +199,10 @@ func ReadTransaction(db ethdb.Reader, hash common.Hash) (*types.Transaction, com
return tx, blockHash, *blockNumber, txIndex return tx, blockHash, *blockNumber, txIndex
} }
// ReadReceipt retrieves a specific transaction receipt from the database, along with // ReadCanonicalReceipt retrieves a specific transaction receipt from the database,
// its added positional metadata. // along with its added positional metadata. Notably, only the receipt in the canonical
func ReadReceipt(db ethdb.Reader, hash common.Hash, config *params.ChainConfig) (*types.Receipt, common.Hash, uint64, uint64) { // chain is visible.
func ReadCanonicalReceipt(db ethdb.Reader, hash common.Hash, config *params.ChainConfig) (*types.Receipt, common.Hash, uint64, uint64) {
// Retrieve the context of the receipt based on the transaction hash // Retrieve the context of the receipt based on the transaction hash
blockNumber := ReadTxLookupEntry(db, hash) blockNumber := ReadTxLookupEntry(db, hash)
if blockNumber == nil { if blockNumber == nil {
@ -220,7 +227,91 @@ func ReadReceipt(db ethdb.Reader, hash common.Hash, config *params.ChainConfig)
return nil, common.Hash{}, 0, 0 return nil, common.Hash{}, 0, 0
} }
// ReadFilterMapRow retrieves a filter map row at the given mapRowIndex // extractReceiptFields takes a raw RLP-encoded receipt blob and extracts
// specific fields from it.
func extractReceiptFields(receiptRLP rlp.RawValue) (uint64, uint, error) {
receiptList, _, err := rlp.SplitList(receiptRLP)
if err != nil {
return 0, 0, err
}
// Decode the field: receipt status
// for receipt before the byzantium fork:
// - bytes: post state root
// for receipt after the byzantium fork:
// - bytes: receipt status flag
_, _, rest, err := rlp.Split(receiptList)
if err != nil {
return 0, 0, err
}
// Decode the field: cumulative gas used (type: uint64)
gasUsed, rest, err := rlp.SplitUint64(rest)
if err != nil {
return 0, 0, err
}
// Decode the field: logs (type: rlp list)
logList, _, err := rlp.SplitList(rest)
if err != nil {
return 0, 0, err
}
logCount, err := rlp.CountValues(logList)
if err != nil {
return 0, 0, err
}
return gasUsed, uint(logCount), nil
}
// RawReceiptContext carries the contextual information that is needed to derive
// a complete receipt from a raw one.
type RawReceiptContext struct {
GasUsed uint64 // Amount of gas used by the associated transaction
LogIndex uint // Starting index of the logs within the block
}
// ReadCanonicalRawReceipt reads a raw receipt at the specified position. It also
// returns the gas used by the associated transaction and the starting index of
// the logs within the block. The main difference with ReadCanonicalReceipt is
// that the additional positional fields are not directly included in the receipt.
// Notably, only receipts from the canonical chain are visible.
func ReadCanonicalRawReceipt(db ethdb.Reader, blockHash common.Hash, blockNumber, txIndex uint64) (*types.Receipt, RawReceiptContext, error) {
receiptIt, err := rlp.NewListIterator(ReadCanonicalReceiptsRLP(db, blockNumber, &blockHash))
if err != nil {
return nil, RawReceiptContext{}, err
}
var (
cumulativeGasUsed uint64
logIndex uint
)
for i := uint64(0); i <= txIndex; i++ {
// Unexpected iteration error
if receiptIt.Err() != nil {
return nil, RawReceiptContext{}, receiptIt.Err()
}
// Unexpected end of iteration
if !receiptIt.Next() {
return nil, RawReceiptContext{}, fmt.Errorf("receipt not found, %d, %x, %d", blockNumber, blockHash, txIndex)
}
if i == txIndex {
var stored types.ReceiptForStorage
if err := rlp.DecodeBytes(receiptIt.Value(), &stored); err != nil {
return nil, RawReceiptContext{}, err
}
return (*types.Receipt)(&stored), RawReceiptContext{
GasUsed: stored.CumulativeGasUsed - cumulativeGasUsed,
LogIndex: logIndex,
}, nil
} else {
gas, logs, err := extractReceiptFields(receiptIt.Value())
if err != nil {
return nil, RawReceiptContext{}, err
}
cumulativeGasUsed = gas
logIndex += logs
}
}
return nil, RawReceiptContext{}, fmt.Errorf("receipt not found, %d, %x, %d", blockNumber, blockHash, txIndex)
}
// ReadFilterMapExtRow retrieves a filter map row at the given mapRowIndex
// (see filtermaps.mapRowIndex for the storage index encoding). // (see filtermaps.mapRowIndex for the storage index encoding).
// Note that zero length rows are not stored in the database and therefore all // Note that zero length rows are not stored in the database and therefore all
// non-existent entries are interpreted as empty rows and return no error. // non-existent entries are interpreted as empty rows and return no error.
@ -247,7 +338,7 @@ func ReadFilterMapExtRow(db ethdb.KeyValueReader, mapRowIndex uint64, bitLength
return nil, err return nil, err
} }
if len(encRow)%byteLength != 0 { if len(encRow)%byteLength != 0 {
return nil, errors.New("Invalid encoded extended filter row length") return nil, errors.New("invalid encoded extended filter row length")
} }
row := make([]uint32, len(encRow)/byteLength) row := make([]uint32, len(encRow)/byteLength)
var b [4]byte var b [4]byte
@ -301,7 +392,7 @@ func ReadFilterMapBaseRows(db ethdb.KeyValueReader, mapRowIndex uint64, rowCount
headerBits-- headerBits--
} }
if headerLen+byteLength*entryCount > encLen { if headerLen+byteLength*entryCount > encLen {
return nil, errors.New("Invalid encoded base filter rows length") return nil, errors.New("invalid encoded base filter rows length")
} }
if entriesInRow > 0 { if entriesInRow > 0 {
rows[rowIndex] = make([]uint32, entriesInRow) rows[rowIndex] = make([]uint32, entriesInRow)
@ -318,8 +409,8 @@ func ReadFilterMapBaseRows(db ethdb.KeyValueReader, mapRowIndex uint64, rowCount
return rows, nil return rows, nil
} }
// WriteFilterMapRow stores a filter map row at the given mapRowIndex or deletes // WriteFilterMapExtRow stores an extended filter map row at the given mapRowIndex
// any existing entry if the row is empty. // or deletes any existing entry if the row is empty.
func WriteFilterMapExtRow(db ethdb.KeyValueWriter, mapRowIndex uint64, row []uint32, bitLength uint) { func WriteFilterMapExtRow(db ethdb.KeyValueWriter, mapRowIndex uint64, row []uint32, bitLength uint) {
byteLength := int(bitLength) / 8 byteLength := int(bitLength) / 8
if int(bitLength) != byteLength*8 { if int(bitLength) != byteLength*8 {

View file

@ -17,6 +17,7 @@
package rawdb package rawdb
import ( import (
"errors"
"math/big" "math/big"
"testing" "testing"
@ -88,7 +89,7 @@ func TestLookupStorage(t *testing.T) {
// Check that no transactions entries are in a pristine database // Check that no transactions entries are in a pristine database
for i, tx := range txs { for i, tx := range txs {
if txn, _, _, _ := ReadTransaction(db, tx.Hash()); txn != nil { if txn, _, _, _ := ReadCanonicalTransaction(db, tx.Hash()); txn != nil {
t.Fatalf("tx #%d [%x]: non existent transaction returned: %v", i, tx.Hash(), txn) t.Fatalf("tx #%d [%x]: non existent transaction returned: %v", i, tx.Hash(), txn)
} }
} }
@ -98,7 +99,7 @@ func TestLookupStorage(t *testing.T) {
tc.writeTxLookupEntriesByBlock(db, block) tc.writeTxLookupEntriesByBlock(db, block)
for i, tx := range txs { for i, tx := range txs {
if txn, hash, number, index := ReadTransaction(db, tx.Hash()); txn == nil { if txn, hash, number, index := ReadCanonicalTransaction(db, tx.Hash()); txn == nil {
t.Fatalf("tx #%d [%x]: transaction not found", i, tx.Hash()) t.Fatalf("tx #%d [%x]: transaction not found", i, tx.Hash())
} else { } else {
if hash != block.Hash() || number != block.NumberU64() || index != uint64(i) { if hash != block.Hash() || number != block.NumberU64() || index != uint64(i) {
@ -112,7 +113,7 @@ func TestLookupStorage(t *testing.T) {
// Delete the transactions and check purge // Delete the transactions and check purge
for i, tx := range txs { for i, tx := range txs {
DeleteTxLookupEntry(db, tx.Hash()) DeleteTxLookupEntry(db, tx.Hash())
if txn, _, _, _ := ReadTransaction(db, tx.Hash()); txn != nil { if txn, _, _, _ := ReadCanonicalTransaction(db, tx.Hash()); txn != nil {
t.Fatalf("tx #%d [%x]: deleted transaction returned: %v", i, tx.Hash(), txn) t.Fatalf("tx #%d [%x]: deleted transaction returned: %v", i, tx.Hash(), txn)
} }
} }
@ -219,3 +220,80 @@ func TestFindTxInBlockBody(t *testing.T) {
} }
} }
} }
func TestExtractReceiptFields(t *testing.T) {
receiptWithPostState := types.ReceiptForStorage(types.Receipt{
Type: types.LegacyTxType,
PostState: []byte{0x1, 0x2, 0x3},
CumulativeGasUsed: 100,
})
receiptWithPostStateBlob, _ := rlp.EncodeToBytes(&receiptWithPostState)
receiptNoLogs := types.ReceiptForStorage(types.Receipt{
Type: types.LegacyTxType,
Status: types.ReceiptStatusSuccessful,
CumulativeGasUsed: 100,
})
receiptNoLogBlob, _ := rlp.EncodeToBytes(&receiptNoLogs)
receiptWithLogs := types.ReceiptForStorage(types.Receipt{
Type: types.LegacyTxType,
Status: types.ReceiptStatusSuccessful,
CumulativeGasUsed: 100,
Logs: []*types.Log{
{
Address: common.BytesToAddress([]byte{0x1}),
Topics: []common.Hash{
common.BytesToHash([]byte{0x1}),
},
Data: []byte{0x1},
},
{
Address: common.BytesToAddress([]byte{0x2}),
Topics: []common.Hash{
common.BytesToHash([]byte{0x2}),
},
Data: []byte{0x2},
},
},
})
receiptWithLogBlob, _ := rlp.EncodeToBytes(&receiptWithLogs)
invalidReceipt := types.ReceiptForStorage(types.Receipt{
Type: types.LegacyTxType,
Status: types.ReceiptStatusSuccessful,
CumulativeGasUsed: 100,
})
invalidReceiptBlob, _ := rlp.EncodeToBytes(&invalidReceipt)
invalidReceiptBlob[len(invalidReceiptBlob)-1] = 0xf
var cases = []struct {
logs rlp.RawValue
expErr error
expGasUsed uint64
expLogs uint
}{
{receiptWithPostStateBlob, nil, 100, 0},
{receiptNoLogBlob, nil, 100, 0},
{receiptWithLogBlob, nil, 100, 2},
{invalidReceiptBlob, rlp.ErrExpectedList, 100, 0},
}
for _, c := range cases {
gasUsed, logs, err := extractReceiptFields(c.logs)
if c.expErr != nil {
if !errors.Is(err, c.expErr) {
t.Fatalf("Unexpected error, want: %v, got: %v", c.expErr, err)
}
} else {
if err != nil {
t.Fatalf("Unexpected error %v", err)
}
if gasUsed != c.expGasUsed {
t.Fatalf("Unexpected gas used, want %d, got %d", c.expGasUsed, gasUsed)
}
if logs != c.expLogs {
t.Fatalf("Unexpected logs, want %d, got %d", c.expLogs, logs)
}
}
}
}

View file

@ -0,0 +1,30 @@
// Copyright 2025 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package rawdb
import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethdb"
)
func ReadVerkleTransitionState(db ethdb.KeyValueReader, hash common.Hash) ([]byte, error) {
return db.Get(transitionStateKey(hash))
}
func WriteVerkleTransitionState(db ethdb.KeyValueWriter, hash common.Hash, state []byte) error {
return db.Put(transitionStateKey(hash), state)
}

Some files were not shown because too many files have changed in this diff Show more