feat(build): Upgrade go version to 1.18 (#241)

* update go version

* update go version

* format code by goimports

* format code by goimports

* go mod tidy

* update go version

* update go version

* upgrade linter

* add exclude rule

* fix golangci exclude

---------

Co-authored-by: vincent <419436363@qq.com>
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
This commit is contained in:
maskpp 2023-03-06 13:32:39 +08:00 committed by GitHub
parent 29e450264c
commit d1f9523b08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
104 changed files with 901 additions and 817 deletions

View file

@ -7,7 +7,7 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.17.x go-version: 1.18.x
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Lint - name: Lint
@ -26,9 +26,9 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.17.x go-version: 1.18.x
- name: Install goimports - name: Install goimports
run: go get golang.org/x/tools/cmd/goimports run: go install golang.org/x/tools/cmd/goimports@latest
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- run: goimports -local github.com/scroll-tech/go-ethereum/ -w . - run: goimports -local github.com/scroll-tech/go-ethereum/ -w .

View file

@ -30,6 +30,11 @@ linters-settings:
goconst: goconst:
min-len: 3 # minimum length of string constant min-len: 3 # minimum length of string constant
min-occurrences: 6 # minimum number of occurrences min-occurrences: 6 # minimum number of occurrences
gosec:
excludes:
- G404 # Use of weak random number generator - lots of FP
- G107 # Potential http request -- those are intentional
- G306 # G306: Expect WriteFile permissions to be 0600 or less
issues: issues:
exclude-rules: exclude-rules:
@ -48,3 +53,13 @@ issues:
- path: cmd/faucet/ - path: cmd/faucet/
linters: linters:
- deadcode - deadcode
- path: crypto/bn256/cloudflare/optate.go
linters:
- deadcode
- staticcheck
- path: common/fdlimit/fdlimit_test.go
linters:
- gosimple
- path: core/vm/contracts_test.go
linters:
- gosimple

View file

@ -4,7 +4,7 @@ ARG VERSION=""
ARG BUILDNUM="" ARG BUILDNUM=""
# Build Geth in a stock Go builder container # Build Geth in a stock Go builder container
FROM golang:1.17-alpine as builder FROM golang:1.18-alpine as builder
ENV GOPROXY https://proxy.golang.org,direct ENV GOPROXY https://proxy.golang.org,direct

View file

@ -4,7 +4,7 @@ ARG VERSION=""
ARG BUILDNUM="" ARG BUILDNUM=""
# Build Geth in a stock Go builder container # Build Geth in a stock Go builder container
FROM golang:1.17-alpine as builder FROM golang:1.18-alpine as builder
RUN apk add --no-cache gcc musl-dev linux-headers git RUN apk add --no-cache gcc musl-dev linux-headers git

View file

@ -165,6 +165,7 @@ func TestInvalidABI(t *testing.T) {
// TestConstructor tests a constructor function. // TestConstructor tests a constructor function.
// The test is based on the following contract: // The test is based on the following contract:
//
// contract TestConstructor { // contract TestConstructor {
// constructor(uint256 a, uint256 b) public{} // constructor(uint256 a, uint256 b) public{}
// } // }
@ -724,6 +725,7 @@ func TestBareEvents(t *testing.T) {
} }
// TestUnpackEvent is based on this contract: // TestUnpackEvent is based on this contract:
//
// contract T { // contract T {
// event received(address sender, uint amount, bytes memo); // event received(address sender, uint amount, bytes memo);
// event receivedAddr(address sender); // event receivedAddr(address sender);
@ -732,7 +734,9 @@ func TestBareEvents(t *testing.T) {
// receivedAddr(msg.sender); // receivedAddr(msg.sender);
// } // }
// } // }
//
// When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt: // When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt:
//
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]} // receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
func TestUnpackEvent(t *testing.T) { func TestUnpackEvent(t *testing.T) {
const abiJSON = `[{"constant":false,"inputs":[{"name":"memo","type":"bytes"}],"name":"receive","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"memo","type":"bytes"}],"name":"received","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"}],"name":"receivedAddr","type":"event"}]` const abiJSON = `[{"constant":false,"inputs":[{"name":"memo","type":"bytes"}],"name":"receive","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"},{"indexed":false,"name":"amount","type":"uint256"},{"indexed":false,"name":"memo","type":"bytes"}],"name":"received","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sender","type":"address"}],"name":"receivedAddr","type":"event"}]`
@ -1080,6 +1084,7 @@ func TestDoubleDuplicateMethodNames(t *testing.T) {
// TestDoubleDuplicateEventNames checks that if send0 already exists, there won't be a name // TestDoubleDuplicateEventNames checks that if send0 already exists, there won't be a name
// conflict and that the second send event will be renamed send1. // conflict and that the second send event will be renamed send1.
// The test runs the abi of the following contract. // The test runs the abi of the following contract.
//
// contract DuplicateEvent { // contract DuplicateEvent {
// event send(uint256 a); // event send(uint256 a);
// event send0(); // event send0();
@ -1108,6 +1113,7 @@ func TestDoubleDuplicateEventNames(t *testing.T) {
// TestUnnamedEventParam checks that an event with unnamed parameters is // TestUnnamedEventParam checks that an event with unnamed parameters is
// correctly handled. // correctly handled.
// The test runs the abi of the following contract. // The test runs the abi of the following contract.
//
// contract TestEvent { // contract TestEvent {
// event send(uint256, uint256); // event send(uint256, uint256);
// } // }

View file

@ -1015,6 +1015,7 @@ func TestCodeAt(t *testing.T) {
} }
// When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt: // When receive("X") is called with sender 0x00... and value 1, it produces this tx receipt:
//
// receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]} // receipt{status=1 cgas=23949 bloom=00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000040200000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[log: b6818c8064f645cd82d99b59a1a267d6d61117ef [75fd880d39c1daf53b6547ab6cb59451fc6452d27caa90e5b6649dd8293b9eed] 000000000000000000000000376c47978271565f56deb45495afa69e59c16ab200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000158 9ae378b6d4409eada347a5dc0c180f186cb62dc68fcc0f043425eb917335aa28 0 95d429d309bb9d753954195fe2d69bd140b4ae731b9b5b605c34323de162cf00 0]}
func TestPendingAndCallContract(t *testing.T) { func TestPendingAndCallContract(t *testing.T) {
testAddr := crypto.PubkeyToAddress(testKey.PublicKey) testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
@ -1226,6 +1227,7 @@ func TestFork(t *testing.T) {
Example contract to test event emission: Example contract to test event emission:
pragma solidity >=0.7.0 <0.9.0; pragma solidity >=0.7.0 <0.9.0;
contract Callable { contract Callable {
event Called(); event Called();
function Call() public { emit Called(); } function Call() public { emit Called(); }
@ -1247,6 +1249,7 @@ const callableBin = "6080604052348015600f57600080fd5b5060998061001e6000396000f3f
// 7. Mine two blocks to trigger a reorg. // 7. Mine two blocks to trigger a reorg.
// 8. Check that the event was removed. // 8. Check that the event was removed.
// 9. Re-send the transaction and mine a block. // 9. Re-send the transaction and mine a block.
//
// 10. Check that the event was reborn. // 10. Check that the event was reborn.
func TestForkLogsReborn(t *testing.T) { func TestForkLogsReborn(t *testing.T) {
testAddr := crypto.PubkeyToAddress(testKey.PublicKey) testAddr := crypto.PubkeyToAddress(testKey.PublicKey)

View file

@ -28,11 +28,13 @@ import (
// given type // given type
// e.g. turn // e.g. turn
// var fields []reflect.StructField // var fields []reflect.StructField
//
// fields = append(fields, reflect.StructField{ // fields = append(fields, reflect.StructField{
// Name: "X", // Name: "X",
// Type: reflect.TypeOf(new(big.Int)), // Type: reflect.TypeOf(new(big.Int)),
// Tag: reflect.StructTag("json:\"" + "x" + "\""), // Tag: reflect.StructTag("json:\"" + "x" + "\""),
// } // }
//
// into // into
// type TupleT struct { X *big.Int } // type TupleT struct { X *big.Int }
func ConvertType(in interface{}, proto interface{}) interface{} { func ConvertType(in interface{}, proto interface{}) interface{} {
@ -171,10 +173,14 @@ func setStruct(dst, src reflect.Value) error {
// mapArgNamesToStructFields maps a slice of argument names to struct fields. // mapArgNamesToStructFields maps a slice of argument names to struct fields.
// first round: for each Exportable field that contains a `abi:""` tag // first round: for each Exportable field that contains a `abi:""` tag
//
// and this field name exists in the given argument name list, pair them together. // and this field name exists in the given argument name list, pair them together.
//
// second round: for each argument name that has not been already linked, // second round: for each argument name that has not been already linked,
//
// find what variable is expected to be mapped into, if it exists and has not been // find what variable is expected to be mapped into, if it exists and has not been
// used, pair them. // used, pair them.
//
// Note this function assumes the given value is a struct value. // Note this function assumes the given value is a struct value.
func mapArgNamesToStructFields(argNames []string, value reflect.Value) (map[string]string, error) { func mapArgNamesToStructFields(argNames []string, value reflect.Value) (map[string]string, error) {
typ := value.Type() typ := value.Type()

View file

@ -178,6 +178,7 @@ type Backend interface {
// safely used to calculate a signature from. // safely used to calculate a signature from.
// //
// The hash is calulcated as // The hash is calulcated as
//
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}). // keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
// //
// This gives context to the signed message and prevents signing of transactions. // This gives context to the signed message and prevents signing of transactions.
@ -190,6 +191,7 @@ func TextHash(data []byte) []byte {
// safely used to calculate a signature from. // safely used to calculate a signature from.
// //
// The hash is calulcated as // The hash is calulcated as
//
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}). // keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
// //
// This gives context to the signed message and prevents signing of transactions. // This gives context to the signed message and prevents signing of transactions.

View file

@ -880,6 +880,7 @@ func (s *Session) walletStatus() (*walletStatus, error) {
} }
// derivationPath fetches the wallet's current derivation path from the card. // derivationPath fetches the wallet's current derivation path from the card.
//
//lint:ignore U1000 needs to be added to the console interface //lint:ignore U1000 needs to be added to the console interface
func (s *Session) derivationPath() (accounts.DerivationPath, error) { func (s *Session) derivationPath() (accounts.DerivationPath, error) {
response, err := s.Channel.transmitEncrypted(claSCWallet, insStatus, statusP1Path, 0, nil) response, err := s.Channel.transmitEncrypted(claSCWallet, insStatus, statusP1Path, 0, nil)
@ -995,6 +996,7 @@ func (s *Session) derive(path accounts.DerivationPath) (accounts.Account, error)
} }
// keyExport contains information on an exported keypair. // keyExport contains information on an exported keypair.
//
//lint:ignore U1000 needs to be added to the console interface //lint:ignore U1000 needs to be added to the console interface
type keyExport struct { type keyExport struct {
PublicKey []byte `asn1:"tag:0"` PublicKey []byte `asn1:"tag:0"`
@ -1002,6 +1004,7 @@ type keyExport struct {
} }
// publicKey returns the public key for the current derivation path. // publicKey returns the public key for the current derivation path.
//
//lint:ignore U1000 needs to be added to the console interface //lint:ignore U1000 needs to be added to the console interface
func (s *Session) publicKey() ([]byte, error) { func (s *Session) publicKey() ([]byte, error) {
response, err := s.Channel.transmitEncrypted(claSCWallet, insExportKey, exportP1Any, exportP2Pubkey, nil) response, err := s.Channel.transmitEncrypted(claSCWallet, insExportKey, exportP1Any, exportP2Pubkey, nil)

View file

@ -95,7 +95,6 @@ func (u *URL) UnmarshalJSON(input []byte) error {
// -1 if x < y // -1 if x < y
// 0 if x == y // 0 if x == y
// +1 if x > y // +1 if x > y
//
func (u URL) Cmp(url URL) int { func (u URL) Cmp(url URL) int {
if u.Scheme == url.Scheme { if u.Scheme == url.Scheme {
return strings.Compare(u.Path, url.Path) return strings.Compare(u.Path, url.Path)

View file

@ -407,8 +407,6 @@ func (w *ledgerDriver) ledgerSign(derivationPath []uint32, tx *types.Transaction
// domain hash | 32 bytes // domain hash | 32 bytes
// message hash | 32 bytes // message hash | 32 bytes
// //
//
//
// And the output data is: // And the output data is:
// //
// Description | Length // Description | Length

View file

@ -85,14 +85,14 @@ func (w *trezorDriver) Status() (string, error) {
// Open implements usbwallet.driver, attempting to initialize the connection to // Open implements usbwallet.driver, attempting to initialize the connection to
// the Trezor hardware wallet. Initializing the Trezor is a two or three phase operation: // the Trezor hardware wallet. Initializing the Trezor is a two or three phase operation:
// * The first phase is to initialize the connection and read the wallet's // - The first phase is to initialize the connection and read the wallet's
// features. This phase is invoked if the provided passphrase is empty. The // features. This phase is invoked if the provided passphrase is empty. The
// device will display the pinpad as a result and will return an appropriate // device will display the pinpad as a result and will return an appropriate
// error to notify the user that a second open phase is needed. // error to notify the user that a second open phase is needed.
// * The second phase is to unlock access to the Trezor, which is done by the // - The second phase is to unlock access to the Trezor, which is done by the
// user actually providing a passphrase mapping a keyboard keypad to the pin // user actually providing a passphrase mapping a keyboard keypad to the pin
// number of the user (shuffled according to the pinpad displayed). // number of the user (shuffled according to the pinpad displayed).
// * If needed the device will ask for passphrase which will require calling // - If needed the device will ask for passphrase which will require calling
// open again with the actual passphrase (3rd phase) // open again with the actual passphrase (3rd phase)
func (w *trezorDriver) Open(device io.ReadWriter, passphrase string) error { func (w *trezorDriver) Open(device io.ReadWriter, passphrase string) error {
w.device, w.failure = device, nil w.device, w.failure = device, nil

View file

@ -15,23 +15,24 @@ c4b2349a8d11350ca038b8c57f3cc58dc0b31284bcbed4f7fca39aeed28b4a51 go1.17.2.linux
fa6da0b829a66f5fab7e4e312fd6aa1b2d8f045c7ecee83b3d00f6fe5306759a go1.17.2.windows-amd64.zip fa6da0b829a66f5fab7e4e312fd6aa1b2d8f045c7ecee83b3d00f6fe5306759a go1.17.2.windows-amd64.zip
00575c85dc7a129ba892685a456b27a3f3670f71c8bfde1c5ad151f771d55df7 go1.17.2.windows-arm64.zip 00575c85dc7a129ba892685a456b27a3f3670f71c8bfde1c5ad151f771d55df7 go1.17.2.windows-arm64.zip
d4bd25b9814eeaa2134197dd2c7671bb791eae786d42010d9d788af20dee4bfa golangci-lint-1.42.0-darwin-amd64.tar.gz 658078aaaf7608693f37c4cf1380b2af418ab8b2d23fdb33e7e2d4339328590e golangci-lint-1.46.2-darwin-amd64.tar.gz
e56859c04a2ad5390c6a497b1acb1cc9329ecb1010260c6faae9b5a4c35b35ea golangci-lint-1.42.0-darwin-arm64.tar.gz 81f9b4afd62ec5e612ef8bc3b1d612a88b56ff289874831845cdad394427385f golangci-lint-1.46.2-darwin-arm64.tar.gz
14d912a3fa856830339472fc4dc341933adf15f37bdb7130bbbfcf960ecf4809 golangci-lint-1.42.0-freebsd-386.tar.gz 943486e703e62ec55ecd90caeb22bcd39f8cc3962a93eec18c06b7bae12cb46f golangci-lint-1.46.2-freebsd-386.tar.gz
337257fccc9baeb5ee1cd7e70c153e9d9f59d3afde46d631659500048afbdf80 golangci-lint-1.42.0-freebsd-amd64.tar.gz a75dd9ba7e08e8315c411697171db5375c0f6a1ece9e6fbeb9e9a4386822e17d golangci-lint-1.46.2-freebsd-amd64.tar.gz
6debcc266b629359fdd8eef4f4abb05a621604079d27016265afb5b4593b0eff golangci-lint-1.42.0-freebsd-armv6.tar.gz 83eedca1af72e8be055a1235177eb1b33524fbf08bec5730df2e6c3efade2b23 golangci-lint-1.46.2-freebsd-armv6.tar.gz
878f0e190169db2ce9dde8cefbd99adc4fe28b90b68686bbfcfcc2085e6d693e golangci-lint-1.42.0-freebsd-armv7.tar.gz 513d276c490de6f82baa01f9346d8d78b385f2ae97608f42f05d1f0f1314cd54 golangci-lint-1.46.2-freebsd-armv7.tar.gz
42c78e31faf62b225363eff1b1d2aa74f9dbcb75686c8914aa3e90d6af65cece golangci-lint-1.42.0-linux-386.tar.gz 461a60016d516c69d406dc3e2d4957b722dbe684b7085dfac4802d0f84409e27 golangci-lint-1.46.2-linux-386.tar.gz
6937f62f8e2329e94822dc11c10b871ace5557ae1fcc4ee2f9980cd6aecbc159 golangci-lint-1.42.0-linux-amd64.tar.gz 242cd4f2d6ac0556e315192e8555784d13da5d1874e51304711570769c4f2b9b golangci-lint-1.46.2-linux-amd64.tar.gz
2cf8d23d96cd854a537b355dab2962b960b88a06b615232599f066afd233f246 golangci-lint-1.42.0-linux-arm64.tar.gz ff5448ada2b3982581984d64b0dec614dba0a3ea4cab2d6a343c77927fc89f7e golangci-lint-1.46.2-linux-arm64.tar.gz
08b003d1ed61367473886defc957af5301066e62338e5d96a319c34dadc4c1d1 golangci-lint-1.42.0-linux-armv6.tar.gz 177f5210ef04aee282bfbc6ec519d36af5fb7d2b2c8d3f4ea5e59fdba71b0a27 golangci-lint-1.46.2-linux-armv6.tar.gz
c7c00ec4845e806a1f32685f5b150219e180bd6d6a9d584be8d27f0c41d7a1bf golangci-lint-1.42.0-linux-armv7.tar.gz 10dd512a36ee978a1009edbca3ba3af410f0fda8df4d85f0e4793a24213870cc golangci-lint-1.46.2-linux-armv7.tar.gz
3650fcf29eb3d8ee326d77791a896b15259eb2d5bf77437dc72e7efe5af6bd40 golangci-lint-1.42.0-linux-mips64.tar.gz 67779fa517c688c9db1090c3c456117d95c6b92979c623fe8cce8fb84251f21e golangci-lint-1.46.2-linux-mips64.tar.gz
f51ae003fdbca4fef78ba73e2eb736a939c8eaa178cd452234213b489da5a420 golangci-lint-1.42.0-linux-mips64le.tar.gz c085f0f57bdccbb2c902a41b72ce210a3dfff16ca856789374745ab52004b6ee golangci-lint-1.46.2-linux-mips64le.tar.gz
1b0bb7b8b22cc4ea7da44fd5ad5faaf6111d0677e01cc6f961b62a96537de2c6 golangci-lint-1.42.0-linux-ppc64le.tar.gz abecef6421499248e58ed75d2938bc12b4b1f98b057f25060680b77bb51a881e golangci-lint-1.46.2-linux-ppc64le.tar.gz
8cb56927eb75e572450efbe0ff0f9cf3f56dc9faa81d9e8d30d6559fc1d06e6d golangci-lint-1.42.0-linux-riscv64.tar.gz 134843a8f5c5c182c11979ea75f5866945d54757b2a04f3e5e04a0cf4fbf3a39 golangci-lint-1.46.2-linux-riscv64.tar.gz
5ac41cd31825a176b21505a371a7b307cd9cdf17df0f35bbb3bf1466f9356ccc golangci-lint-1.42.0-linux-s390x.tar.gz 9fe21a9476567aafe7a2e1a926b9641a39f920d4c0ea8eda9d968bc6136337f9 golangci-lint-1.46.2-linux-s390x.tar.gz
e1cebd2af621ac4b64c20937df92c3819264f2174c92f51e196db1e64ae097e0 golangci-lint-1.42.0-windows-386.zip b48a421ec12a43f8fc8f977b9cf7d4a1ea1c4b97f803a238de7d3ce4ab23a84b golangci-lint-1.46.2-windows-386.zip
7e70fcde8e87a17cae0455df07d257ebc86669f3968d568e12727fa24bbe9883 golangci-lint-1.42.0-windows-amd64.zip 604acc1378a566abb0eac799362f3a37b7fcb5fa2268aeb2d5d954c829367301 golangci-lint-1.46.2-windows-amd64.zip
59da7ce1bda432616bfc28ae663e52c3675adee8d9bf5959fafd657c159576ab golangci-lint-1.42.0-windows-armv6.zip 927def10db073da9687594072e6a3d9c891f67fa897105a2cfd715e018e7386c golangci-lint-1.46.2-windows-arm64.zip
65f62dda937bfcede0326ac77abe947ce1548931e6e13298ca036cb31f224db5 golangci-lint-1.42.0-windows-armv7.zip 729b76ed1d8b4e2612e38772b211503cb940e00a137bbaace1aa066f7c943737 golangci-lint-1.46.2-windows-armv6.zip
ea27c86d91e0b245ecbcfbf6cdb4ac0522d4bc6dca56bba02ea1bc77ad2917ac golangci-lint-1.46.2-windows-armv7.zip

View file

@ -36,7 +36,6 @@ Available commands are:
purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore purge [ -store blobstore ] [ -days threshold ] -- purges old archives from the blobstore
For all commands, -n prevents execution of external programs (dry run mode). For all commands, -n prevents execution of external programs (dry run mode).
*/ */
package main package main
@ -332,7 +331,7 @@ func doLint(cmdline []string) {
// downloadLinter downloads and unpacks golangci-lint. // downloadLinter downloads and unpacks golangci-lint.
func downloadLinter(cachedir string) string { func downloadLinter(cachedir string) string {
const version = "1.42.0" const version = "1.46.2"
csdb := build.MustLoadChecksums("build/checksums.txt") csdb := build.MustLoadChecksums("build/checksums.txt")
base := fmt.Sprintf("golangci-lint-%s-%s-%s", version, runtime.GOOS, runtime.GOARCH) base := fmt.Sprintf("golangci-lint-%s-%s-%s", version, runtime.GOOS, runtime.GOARCH)

View file

@ -1,7 +1,7 @@
pipeline { pipeline {
agent any agent any
tools { tools {
go 'go-1.17' go 'go-1.18'
} }
environment { environment {
GO111MODULE = 'on' GO111MODULE = 'on'

View file

@ -51,6 +51,7 @@ func getPassphrase(ctx *cli.Context, confirmation bool) string {
// that can be safely used to calculate a signature from. // that can be safely used to calculate a signature from.
// //
// The hash is calulcated as // The hash is calulcated as
//
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}). // keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
// //
// This gives context to the signed message and prevents signing of transactions. // This gives context to the signed message and prevents signing of transactions.

View file

@ -323,6 +323,7 @@ func (t *txWithKey) UnmarshalJSON(input []byte) error {
// The transactions can have two forms, either // The transactions can have two forms, either
// 1. unsigned or // 1. unsigned or
// 2. signed // 2. signed
//
// For (1), r, s, v, need so be zero, and the `secretKey` needs to be set. // For (1), r, s, v, need so be zero, and the `secretKey` needs to be set.
// If so, we sign it here and now, with the given `secretKey` // If so, we sign it here and now, with the given `secretKey`
// If the condition above is not met, then it's considered a signed transaction. // If the condition above is not met, then it's considered a signed transaction.

View file

@ -187,11 +187,13 @@ var _bindata = map[string]func() (*asset, error){
// directory embedded in the file by go-bindata. // directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the // For example if you run go-bindata on data/... and data contains the
// following hierarchy: // following hierarchy:
//
// data/ // data/
// foo.txt // foo.txt
// img/ // img/
// a.png // a.png
// b.png // b.png
//
// then AssetDir("data") would return []string{"foo.txt", "img"}, // then AssetDir("data") would return []string{"foo.txt", "img"},
// AssetDir("data/img") would return []string{"a.png", "b.png"}, // AssetDir("data/img") would return []string{"a.png", "b.png"},
// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and // AssetDir("foo.txt") and AssetDir("notexist") would return an error, and

View file

@ -33,7 +33,6 @@
// //
// $ p2psim node connect node01 node02 // $ p2psim node connect node01 node02
// Connected node01 to node02 // Connected node01 to node02
//
package main package main
import ( import (

View file

@ -18,7 +18,7 @@
Package hexutil implements hex encoding with 0x prefix. Package hexutil implements hex encoding with 0x prefix.
This encoding is used by the Ethereum RPC API to transport binary data in JSON payloads. This encoding is used by the Ethereum RPC API to transport binary data in JSON payloads.
Encoding Rules # Encoding Rules
All hex data must have prefix "0x". All hex data must have prefix "0x".

View file

@ -29,6 +29,7 @@ import (
// - priority evaluates the actual priority of an item // - priority evaluates the actual priority of an item
// - maxPriority gives an upper estimate for the priority in any moment between // - maxPriority gives an upper estimate for the priority in any moment between
// now and the given absolute time // now and the given absolute time
//
// If the upper estimate is exceeded then Update should be called for that item. // If the upper estimate is exceeded then Update should be called for that item.
// A global Refresh function should also be called periodically. // A global Refresh function should also be called periodically.
type LazyQueue struct { type LazyQueue struct {

View file

@ -34,6 +34,7 @@ type API struct {
// GetWork returns a work package for external miner. // GetWork returns a work package for external miner.
// //
// The work package consists of 3 strings: // The work package consists of 3 strings:
//
// result[0] - 32 bytes hex encoded current block header pow-hash // result[0] - 32 bytes hex encoded current block header pow-hash
// result[1] - 32 bytes hex encoded seed hash used for DAG // result[1] - 32 bytes hex encoded seed hash used for DAG
// result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty // result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty

View file

@ -339,6 +339,7 @@ func (s *remoteSealer) loop() {
// makeWork creates a work package for external miner. // makeWork creates a work package for external miner.
// //
// The work package consists of 3 strings: // The work package consists of 3 strings:
//
// result[0], 32 bytes hex encoded current block header pow-hash // result[0], 32 bytes hex encoded current block header pow-hash
// result[1], 32 bytes hex encoded seed hash used for DAG // result[1], 32 bytes hex encoded seed hash used for DAG
// result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty // result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty

View file

@ -40,6 +40,7 @@ var (
// ensure it conforms to DAO hard-fork rules. // ensure it conforms to DAO hard-fork rules.
// //
// DAO hard-fork extension to the header validity: // DAO hard-fork extension to the header validity:
//
// a) if the node is no-fork, do not accept blocks in the [fork, fork+10) range // a) if the node is no-fork, do not accept blocks in the [fork, fork+10) range
// with the fork specific extra-data set // with the fork specific extra-data set
// b) if the node is pro-fork, require blocks in the specific range to have the // b) if the node is pro-fork, require blocks in the specific range to have the

View file

@ -1867,6 +1867,7 @@ func testSideImport(t *testing.T, numCanonBlocksInSidechain, blocksBetweenCommon
// That is: the sidechain for import contains some blocks already present in canon chain. // That is: the sidechain for import contains some blocks already present in canon chain.
// So the blocks are // So the blocks are
// [ Cn, Cn+1, Cc, Sn+3 ... Sm] // [ Cn, Cn+1, Cc, Sn+3 ... Sm]
//
// ^ ^ ^ pruned // ^ ^ ^ pruned
func TestPrunedImportSide(t *testing.T) { func TestPrunedImportSide(t *testing.T) {
//glogger := log.NewGlogHandler(log.StreamHandler(os.Stdout, log.TerminalFormat(false))) //glogger := log.NewGlogHandler(log.StreamHandler(os.Stdout, log.TerminalFormat(false)))
@ -2649,7 +2650,6 @@ func TestDeleteCreateRevert(t *testing.T) {
// to the destructset in case something is created "onto" an existing item. // to the destructset in case something is created "onto" an existing item.
// We need to either roll back the snapDestructs, or not place it into snapDestructs // We need to either roll back the snapDestructs, or not place it into snapDestructs
// in the first place. // in the first place.
//
func TestInitThenFailCreateContract(t *testing.T) { func TestInitThenFailCreateContract(t *testing.T) {
var ( var (
// Generate a canonical chain to act as the main dataset // Generate a canonical chain to act as the main dataset

View file

@ -18,12 +18,10 @@
// +build none // +build none
/* /*
The mkalloc tool creates the genesis allocation constants in genesis_alloc.go The mkalloc tool creates the genesis allocation constants in genesis_alloc.go
It outputs a const declaration that contains an RLP-encoded list of (address, balance) tuples. It outputs a const declaration that contains an RLP-encoded list of (address, balance) tuples.
go run mkalloc.go genesis.json go run mkalloc.go genesis.json
*/ */
package main package main

View file

@ -235,10 +235,12 @@ func (t *testHelper) Generate() (common.Hash, *diskLayer) {
// - miss in the beginning // - miss in the beginning
// - miss in the middle // - miss in the middle
// - miss in the end // - miss in the end
//
// - the contract(non-empty storage) has wrong storage slots // - the contract(non-empty storage) has wrong storage slots
// - wrong slots in the beginning // - wrong slots in the beginning
// - wrong slots in the middle // - wrong slots in the middle
// - wrong slots in the end // - wrong slots in the end
//
// - the contract(non-empty storage) has extra storage slots // - the contract(non-empty storage) has extra storage slots
// - extra slots in the beginning // - extra slots in the beginning
// - extra slots in the middle // - extra slots in the middle

View file

@ -34,9 +34,11 @@ var (
// MarshalFields marshalls a StateAccount into a sequence of bytes. The bytes scheme is: // MarshalFields marshalls a StateAccount into a sequence of bytes. The bytes scheme is:
// [0:32] (bytes in big-endian) // [0:32] (bytes in big-endian)
//
// [0:16] Reserved with all 0 // [0:16] Reserved with all 0
// [16:24] CodeSize, uint64 in big-endian // [16:24] CodeSize, uint64 in big-endian
// [24:32] Nonce, uint64 in big-endian // [24:32] Nonce, uint64 in big-endian
//
// [32:64] Balance // [32:64] Balance
// [64:96] StorageRoot // [64:96] StorageRoot
// [96:128] KeccakCodeHash // [96:128] KeccakCodeHash

View file

@ -266,6 +266,7 @@ var (
// modexpMultComplexity implements bigModexp multComplexity formula, as defined in EIP-198 // modexpMultComplexity implements bigModexp multComplexity formula, as defined in EIP-198
// //
// def mult_complexity(x): // def mult_complexity(x):
//
// if x <= 64: return x ** 2 // if x <= 64: return x ** 2
// elif x <= 1024: return x ** 2 // 4 + 96 * x - 3072 // elif x <= 1024: return x ** 2 // 4 + 96 * x - 3072
// else: return x ** 2 // 16 + 480 * x - 199680 // else: return x ** 2 // 16 + 480 * x - 199680

View file

@ -391,16 +391,21 @@ func opExtCodeCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext)
// opExtCodeHash returns the code hash of a specified account. // opExtCodeHash returns the code hash of a specified account.
// There are several cases when the function is called, while we can relay everything // There are several cases when the function is called, while we can relay everything
// to `state.GetCodeHash` function to ensure the correctness. // to `state.GetCodeHash` function to ensure the correctness.
//
// (1) Caller tries to get the code hash of a normal contract account, state // (1) Caller tries to get the code hash of a normal contract account, state
//
// should return the relative code hash and set it as the result. // should return the relative code hash and set it as the result.
// //
// (2) Caller tries to get the code hash of a non-existent account, state should // (2) Caller tries to get the code hash of a non-existent account, state should
//
// return common.Hash{} and zero will be set as the result. // return common.Hash{} and zero will be set as the result.
// //
// (3) Caller tries to get the code hash for an account without contract code, // (3) Caller tries to get the code hash for an account without contract code,
//
// state should return emptyCodeHash(0xc5d246...) as the result. // state should return emptyCodeHash(0xc5d246...) as the result.
// //
// (4) Caller tries to get the code hash of a precompiled account, the result // (4) Caller tries to get the code hash of a precompiled account, the result
//
// should be zero or emptyCodeHash. // should be zero or emptyCodeHash.
// //
// It is worth noting that in order to avoid unnecessary create and clean, // It is worth noting that in order to avoid unnecessary create and clean,
@ -410,9 +415,11 @@ func opExtCodeCopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext)
// customized chain, the return value will be zero. // customized chain, the return value will be zero.
// //
// (5) Caller tries to get the code hash for an account which is marked as suicided // (5) Caller tries to get the code hash for an account which is marked as suicided
//
// in the current transaction, the code hash of this account should be returned. // in the current transaction, the code hash of this account should be returned.
// //
// (6) Caller tries to get the code hash for an account which is marked as deleted, // (6) Caller tries to get the code hash for an account which is marked as deleted,
//
// this account should be regarded as a non-existent account and zero should be returned. // this account should be regarded as a non-existent account and zero should be returned.
func opExtCodeHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { func opExtCodeHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
slot := scope.Stack.peek() slot := scope.Stack.peek()

View file

@ -702,9 +702,11 @@ func (d *Downloader) fetchHead(p *peerConnection) (head *types.Header, pivot *ty
// calculateRequestSpan calculates what headers to request from a peer when trying to determine the // calculateRequestSpan calculates what headers to request from a peer when trying to determine the
// common ancestor. // common ancestor.
// It returns parameters to be used for peer.RequestHeadersByNumber: // It returns parameters to be used for peer.RequestHeadersByNumber:
//
// from - starting block number // from - starting block number
// count - number of headers to request // count - number of headers to request
// skip - number of headers to skip // skip - number of headers to skip
//
// and also returns 'max', the last block which is expected to be returned by the remote peers, // and also returns 'max', the last block which is expected to be returned by the remote peers,
// given the (from,count,skip) // given the (from,count,skip)
func calculateRequestSpan(remoteHeight, localHeight uint64) (int64, int, int, uint64) { func calculateRequestSpan(remoteHeight, localHeight uint64) (int64, int, int, uint64) {

View file

@ -477,6 +477,7 @@ func (q *queue) ReserveReceipts(p *peerConnection, count int) (*fetchRequest, bo
// to access the queue, so they already need a lock anyway. // to access the queue, so they already need a lock anyway.
// //
// Returns: // Returns:
//
// item - the fetchRequest // item - the fetchRequest
// progress - whether any progress was made // progress - whether any progress was made
// throttle - if the caller should throttle for a while // throttle - if the caller should throttle for a while

View file

@ -71,6 +71,7 @@ func (r *resultStore) SetThrottleThreshold(threshold uint64) uint64 {
// wants to reserve headers for fetching. // wants to reserve headers for fetching.
// //
// It returns the following: // It returns the following:
//
// stale - if true, this item is already passed, and should not be requested again // stale - if true, this item is already passed, and should not be requested again
// throttled - if true, the store is at capacity, this particular header is not prio now // throttled - if true, the store is at capacity, this particular header is not prio now
// item - the result to store data into // item - the result to store data into

View file

@ -188,6 +188,7 @@ func (oracle *Oracle) resolveBlockRange(ctx context.Context, lastBlock rpc.Block
// block, sorted in ascending order and weighted by gas used. // block, sorted in ascending order and weighted by gas used.
// - baseFee: base fee per gas in the given block // - baseFee: base fee per gas in the given block
// - gasUsedRatio: gasUsed/gasLimit in the given block // - gasUsedRatio: gasUsed/gasLimit in the given block
//
// Note: baseFee includes the next block after the newest of the returned range, because this // Note: baseFee includes the next block after the newest of the returned range, because this
// value can be derived from the newest block. // value can be derived from the newest block.
func (oracle *Oracle) FeeHistory(ctx context.Context, blocks int, unresolvedLastBlock rpc.BlockNumber, rewardPercentiles []float64) (*big.Int, [][]*big.Int, []*big.Int, []float64, error) { func (oracle *Oracle) FeeHistory(ctx context.Context, blocks int, unresolvedLastBlock rpc.BlockNumber, rewardPercentiles []float64) (*big.Int, [][]*big.Int, []*big.Int, []float64, error) {

View file

@ -370,6 +370,7 @@ func createStorageRequestResponse(t *testPeer, root common.Hash, accounts []comm
} }
// the createStorageRequestResponseAlwaysProve tests a cornercase, where it always // the createStorageRequestResponseAlwaysProve tests a cornercase, where it always
//
// supplies the proof for the last account, even if it is 'complete'.h // supplies the proof for the last account, even if it is 'complete'.h
func createStorageRequestResponseAlwaysProve(t *testPeer, root common.Hash, accounts []common.Hash, bOrigin, bLimit []byte, max uint64) (hashes [][]common.Hash, slots [][][]byte, proofs [][]byte) { func createStorageRequestResponseAlwaysProve(t *testPeer, root common.Hash, accounts []common.Hash, bOrigin, bLimit []byte, max uint64) (hashes [][]common.Hash, slots [][][]byte, proofs [][]byte) {
var size uint64 var size uint64

View file

@ -388,11 +388,13 @@ const AssetDebug = false
// directory embedded in the file by go-bindata. // directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the // For example if you run go-bindata on data/... and data contains the
// following hierarchy: // following hierarchy:
//
// data/ // data/
// foo.txt // foo.txt
// img/ // img/
// a.png // a.png
// b.png // b.png
//
// then AssetDir("data") would return []string{"foo.txt", "img"}, // then AssetDir("data") would return []string{"foo.txt", "img"},
// AssetDir("data/img") would return []string{"a.png", "b.png"}, // AssetDir("data/img") would return []string{"a.png", "b.png"},
// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and // AssetDir("foo.txt") and AssetDir("notexist") would return an error, and

View file

@ -37,6 +37,7 @@ func init() {
// a reversed signature can be matched against the size of the data. // a reversed signature can be matched against the size of the data.
// //
// Example: // Example:
//
// > debug.traceTransaction( "0x214e597e35da083692f5386141e69f47e973b2c56e7a8073b1ea08fd7571e9de", {tracer: "4byteTracer"}) // > debug.traceTransaction( "0x214e597e35da083692f5386141e69f47e973b2c56e7a8073b1ea08fd7571e9de", {tracer: "4byteTracer"})
// { // {
// 0x27dc297e-128: 1, // 0x27dc297e-128: 1,

View file

@ -27,9 +27,11 @@ Aside from implementing the tracer, it also needs to register itself, using the
Example: Example:
```golang ```golang
func init() { func init() {
register("noopTracerNative", newNoopTracer) register("noopTracerNative", newNoopTracer)
} }
``` ```
*/ */
package native package native

View file

@ -246,6 +246,7 @@ func (db *Database) Path() string {
// the metrics subsystem. // the metrics subsystem.
// //
// This is how a LevelDB stats table looks like (currently): // This is how a LevelDB stats table looks like (currently):
//
// Compactions // Compactions
// Level | Tables | Size(MB) | Time(sec) | Read(MB) | Write(MB) // Level | Tables | Size(MB) | Time(sec) | Read(MB) | Write(MB)
// -------+------------+---------------+---------------+---------------+--------------- // -------+------------+---------------+---------------+---------------+---------------

View file

@ -103,6 +103,7 @@ type Service struct {
// websocket. // websocket.
// //
// From Gorilla websocket docs: // From Gorilla websocket docs:
//
// Connections support one concurrent reader and one concurrent writer. // Connections support one concurrent reader and one concurrent writer.
// Applications are responsible for ensuring that no more than one goroutine calls the write methods // Applications are responsible for ensuring that no more than one goroutine calls the write methods
// - NextWriter, SetWriteDeadline, WriteMessage, WriteJSON, EnableWriteCompression, SetCompressionLevel // - NextWriter, SetWriteDeadline, WriteMessage, WriteJSON, EnableWriteCompression, SetCompressionLevel

41
go.mod
View file

@ -1,6 +1,6 @@
module github.com/scroll-tech/go-ethereum module github.com/scroll-tech/go-ethereum
go 1.15 go 1.18
require ( require (
github.com/Azure/azure-storage-blob-go v0.7.0 github.com/Azure/azure-storage-blob-go v0.7.0
@ -54,15 +54,44 @@ require (
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sync v0.1.0
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 golang.org/x/sys v0.5.0
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f golang.org/x/text v0.7.0
golang.org/x/text v0.3.7
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6
gopkg.in/urfave/cli.v1 v1.20.0 gopkg.in/urfave/cli.v1 v1.20.0
) )
require (
github.com/Azure/azure-pipeline-go v0.2.2 // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.1.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.1.1 // indirect
github.com/aws/smithy-go v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/deepmap/oapi-codegen v1.8.2 // indirect
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/naoina/go-stringutil v0.1.0 // indirect
github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
golang.org/x/net v0.6.0 // indirect
golang.org/x/term v0.5.0 // indirect
google.golang.org/protobuf v1.23.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)

23
go.sum
View file

@ -33,7 +33,6 @@ github.com/Azure/go-autorest/autorest/date v0.2.0 h1:yW+Zlqf26583pE43KhfnhFcdmSW
github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.3.0 h1:qJumjCaCudz+OcqE9/XtEPfvtOjOmKaui4EOpFI6zZc=
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY= github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
@ -90,7 +89,6 @@ github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOC
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
@ -495,8 +493,8 @@ golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -511,8 +509,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -553,13 +551,12 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@ -567,8 +564,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

View file

@ -740,9 +740,9 @@ func (s *PublicBlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.H
} }
// GetBlockByNumber returns the requested canonical block. // GetBlockByNumber returns the requested canonical block.
// * When blockNr is -1 the chain head is returned. // - When blockNr is -1 the chain head is returned.
// * When blockNr is -2 the pending chain head is returned. // - When blockNr is -2 the pending chain head is returned.
// * When fullTx is true all transactions in the block are returned, otherwise // - When fullTx is true all transactions in the block are returned, otherwise
// only the transaction hash is returned. // only the transaction hash is returned.
func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error) { func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error) {
block, err := s.b.BlockByNumber(ctx, number) block, err := s.b.BlockByNumber(ctx, number)

View file

@ -212,11 +212,13 @@ const AssetDebug = false
// directory embedded in the file by go-bindata. // directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the // For example if you run go-bindata on data/... and data contains the
// following hierarchy: // following hierarchy:
//
// data/ // data/
// foo.txt // foo.txt
// img/ // img/
// a.png // a.png
// b.png // b.png
//
// then AssetDir("data") would return []string{"foo.txt", "img"}, // then AssetDir("data") would return []string{"foo.txt", "img"},
// AssetDir("data/img") would return []string{"a.png", "b.png"}, // AssetDir("data/img") would return []string{"a.png", "b.png"},
// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and // AssetDir("foo.txt") and AssetDir("notexist") would return an error, and

View file

@ -366,6 +366,7 @@ func NewPrivateLightAPI(backend *lesCommons) *PrivateLightAPI {
// LatestCheckpoint returns the latest local checkpoint package. // LatestCheckpoint returns the latest local checkpoint package.
// //
// The checkpoint package consists of 4 strings: // The checkpoint package consists of 4 strings:
//
// result[0], hex encoded latest section index // result[0], hex encoded latest section index
// result[1], 32 bytes hex encoded latest section head hash // result[1], 32 bytes hex encoded latest section head hash
// result[2], 32 bytes hex encoded latest section canonical hash trie root hash // result[2], 32 bytes hex encoded latest section canonical hash trie root hash
@ -384,6 +385,7 @@ func (api *PrivateLightAPI) LatestCheckpoint() ([4]string, error) {
// GetLocalCheckpoint returns the specific local checkpoint package. // GetLocalCheckpoint returns the specific local checkpoint package.
// //
// The checkpoint package consists of 3 strings: // The checkpoint package consists of 3 strings:
//
// result[0], 32 bytes hex encoded latest section head hash // result[0], 32 bytes hex encoded latest section head hash
// result[1], 32 bytes hex encoded latest section canonical hash trie root hash // result[1], 32 bytes hex encoded latest section canonical hash trie root hash
// result[2], 32 bytes hex encoded latest section bloom trie root hash // result[2], 32 bytes hex encoded latest section bloom trie root hash

View file

@ -705,9 +705,11 @@ func (d *Downloader) fetchHead(p *peerConnection) (head *types.Header, pivot *ty
// calculateRequestSpan calculates what headers to request from a peer when trying to determine the // calculateRequestSpan calculates what headers to request from a peer when trying to determine the
// common ancestor. // common ancestor.
// It returns parameters to be used for peer.RequestHeadersByNumber: // It returns parameters to be used for peer.RequestHeadersByNumber:
//
// from - starting block number // from - starting block number
// count - number of headers to request // count - number of headers to request
// skip - number of headers to skip // skip - number of headers to skip
//
// and also returns 'max', the last block which is expected to be returned by the remote peers, // and also returns 'max', the last block which is expected to be returned by the remote peers,
// given the (from,count,skip) // given the (from,count,skip)
func calculateRequestSpan(remoteHeight, localHeight uint64) (int64, int, int, uint64) { func calculateRequestSpan(remoteHeight, localHeight uint64) (int64, int, int, uint64) {

View file

@ -477,6 +477,7 @@ func (q *queue) ReserveReceipts(p *peerConnection, count int) (*fetchRequest, bo
// to access the queue, so they already need a lock anyway. // to access the queue, so they already need a lock anyway.
// //
// Returns: // Returns:
//
// item - the fetchRequest // item - the fetchRequest
// progress - whether any progress was made // progress - whether any progress was made
// throttle - if the caller should throttle for a while // throttle - if the caller should throttle for a while

View file

@ -71,6 +71,7 @@ func (r *resultStore) SetThrottleThreshold(threshold uint64) uint64 {
// wants to reserve headers for fetching. // wants to reserve headers for fetching.
// //
// It returns the following: // It returns the following:
//
// stale - if true, this item is already passed, and should not be requested again // stale - if true, this item is already passed, and should not be requested again
// throttled - if true, the store is at capacity, this particular header is not prio now // throttled - if true, the store is at capacity, this particular header is not prio now
// item - the result to store data into // item - the result to store data into

View file

@ -242,6 +242,7 @@ func (f *lightFetcher) forEachPeer(check func(id enode.ID, p *fetcherPeer) bool)
} }
// mainloop is the main event loop of the light fetcher, which is responsible for // mainloop is the main event loop of the light fetcher, which is responsible for
//
// - announcement maintenance(ulc) // - announcement maintenance(ulc)
// If we are running in ultra light client mode, then all announcements from // If we are running in ultra light client mode, then all announcements from
// the trusted servers are maintained. If the same announcements from trusted // the trusted servers are maintained. If the same announcements from trusted

View file

@ -77,8 +77,11 @@ type TxPool struct {
// //
// Send instructs backend to forward new transactions // Send instructs backend to forward new transactions
// NewHead notifies backend about a new head after processed by the tx pool, // NewHead notifies backend about a new head after processed by the tx pool,
//
// including mined and rolled back transactions since the last event // including mined and rolled back transactions since the last event
//
// Discard notifies backend about transactions that should be discarded either // Discard notifies backend about transactions that should be discarded either
//
// because they have been replaced by a re-send or because they have been mined // because they have been replaced by a re-send or because they have been mined
// long ago and no rollback is expected // long ago and no rollback is expected
type TxRelayBackend interface { type TxRelayBackend interface {

View file

@ -13,21 +13,19 @@ This will output a line that looks like:
lvl=info t=2014-05-02T16:07:23-0700 msg="page accessed" path=/org/71/profile user_id=9 lvl=info t=2014-05-02T16:07:23-0700 msg="page accessed" path=/org/71/profile user_id=9
Getting Started # Getting Started
To get started, you'll want to import the library: To get started, you'll want to import the library:
import log "github.com/inconshreveable/log15" import log "github.com/inconshreveable/log15"
Now you're ready to start logging: Now you're ready to start logging:
func main() { func main() {
log.Info("Program starting", "args", os.Args()) log.Info("Program starting", "args", os.Args())
} }
# Convention
Convention
Because recording a human-meaningful message is common and good practice, the first argument to every Because recording a human-meaningful message is common and good practice, the first argument to every
logging method is the value to the *implicit* key 'msg'. logging method is the value to the *implicit* key 'msg'.
@ -46,8 +44,7 @@ If you really do favor your type-safety, you may choose to pass a log.Ctx instea
log.Warn("size out of bounds", log.Ctx{"low": lowBound, "high": highBound, "val": val}) log.Warn("size out of bounds", log.Ctx{"low": lowBound, "high": highBound, "val": val})
# Context loggers
Context loggers
Frequently, you want to add context to a logger so that you can track actions associated with it. An http Frequently, you want to add context to a logger so that you can track actions associated with it. An http
request is a good example. You can easily create new loggers that have context that is automatically included request is a good example. You can easily create new loggers that have context that is automatically included
@ -62,8 +59,7 @@ This will output a log line that includes the path context that is attached to t
lvl=dbug t=2014-05-02T16:07:23-0700 path=/repo/12/add_hook msg="db txn commit" duration=0.12 lvl=dbug t=2014-05-02T16:07:23-0700 path=/repo/12/add_hook msg="db txn commit" duration=0.12
# Handlers
Handlers
The Handler interface defines where log lines are printed to and how they are formatted. Handler is a The Handler interface defines where log lines are printed to and how they are formatted. Handler is a
single interface that is inspired by net/http's handler interface: single interface that is inspired by net/http's handler interface:
@ -72,7 +68,6 @@ single interface that is inspired by net/http's handler interface:
Log(r *Record) error Log(r *Record) error
} }
Handlers can filter records, format them, or dispatch to multiple other Handlers. Handlers can filter records, format them, or dispatch to multiple other Handlers.
This package implements a number of Handlers for common logging patterns that are This package implements a number of Handlers for common logging patterns that are
easily composed to create flexible, custom logging structures. easily composed to create flexible, custom logging structures.
@ -90,7 +85,7 @@ or above in JSON formatted output to the file /var/log/service.json
log.MatchFilterHandler("pkg", "app/rpc" log.StdoutHandler()) log.MatchFilterHandler("pkg", "app/rpc" log.StdoutHandler())
) )
Logging File Names and Line Numbers # Logging File Names and Line Numbers
This package implements three Handlers that add debugging information to the This package implements three Handlers that add debugging information to the
context, CallerFileHandler, CallerFuncHandler and CallerStackHandler. Here's context, CallerFileHandler, CallerFuncHandler and CallerStackHandler. Here's
@ -121,7 +116,7 @@ The "%+v" format instructs the handler to include the path of the source file
relative to the compile time GOPATH. The github.com/go-stack/stack package relative to the compile time GOPATH. The github.com/go-stack/stack package
documents the full list of formatting verbs and modifiers available. documents the full list of formatting verbs and modifiers available.
Custom Handlers # Custom Handlers
The Handler interface is so simple that it's also trivial to write your own. Let's create an The Handler interface is so simple that it's also trivial to write your own. Let's create an
example handler which tries to write to one handler, but if that fails it falls back to example handler which tries to write to one handler, but if that fails it falls back to
@ -146,7 +141,7 @@ fails you want to log those records to a file on disk.
This pattern is so useful that a generic version that handles an arbitrary number of Handlers This pattern is so useful that a generic version that handles an arbitrary number of Handlers
is included as part of this library called FailoverHandler. is included as part of this library called FailoverHandler.
Logging Expensive Operations # Logging Expensive Operations
Sometimes, you want to log values that are extremely expensive to compute, but you don't want to pay Sometimes, you want to log values that are extremely expensive to compute, but you don't want to pay
the price of computing them if you haven't turned up your logging level to a high level of detail. the price of computing them if you haven't turned up your logging level to a high level of detail.
@ -164,7 +159,7 @@ filters it out. Just wrap any function which takes no arguments with the log.Laz
If this message is not logged for any reason (like logging at the Error level), then If this message is not logged for any reason (like logging at the Error level), then
factorRSAKey is never evaluated. factorRSAKey is never evaluated.
Dynamic context values # Dynamic context values
The same log.Lazy mechanism can be used to attach context to a logger which you want to be The same log.Lazy mechanism can be used to attach context to a logger which you want to be
evaluated when the message is logged, but not when the logger is created. For example, let's imagine evaluated when the message is logged, but not when the logger is created. For example, let's imagine
@ -191,14 +186,14 @@ current state no matter when the log message is written:
isAlive := func() bool { return p.alive } isAlive := func() bool { return p.alive }
player.Logger = log.New("name", p.name, "alive", log.Lazy{isAlive}) player.Logger = log.New("name", p.name, "alive", log.Lazy{isAlive})
Terminal Format # Terminal Format
If log15 detects that stdout is a terminal, it will configure the default If log15 detects that stdout is a terminal, it will configure the default
handler for it (which is log.StdoutHandler) to use TerminalFormat. This format handler for it (which is log.StdoutHandler) to use TerminalFormat. This format
logs records nicely for your terminal, including color-coded output based logs records nicely for your terminal, including color-coded output based
on log level. on log level.
Error Handling # Error Handling
Becasuse log15 allows you to step around the type system, there are a few ways you can specify Becasuse log15 allows you to step around the type system, there are a few ways you can specify
invalid arguments to the logging functions. You could, for example, wrap something that is not invalid arguments to the logging functions. You could, for example, wrap something that is not
@ -216,7 +211,7 @@ are encouraged to return errors only if they fail to write their log records out
syslog daemon is not responding. This allows the construction of useful handlers which cope with those failures syslog daemon is not responding. This allows the construction of useful handlers which cope with those failures
like the FailoverHandler. like the FailoverHandler.
Library Use # Library Use
log15 is intended to be useful for library authors as a way to provide configurable logging to log15 is intended to be useful for library authors as a way to provide configurable logging to
users of their library. Best practice for use in a library is to always disable all output for your logger users of their library. Best practice for use in a library is to always disable all output for your logger
@ -242,7 +237,7 @@ Users of your library may then enable it if they like:
yourlib.Log.SetHandler(handler) yourlib.Log.SetHandler(handler)
} }
Best practices attaching logger context # Best practices attaching logger context
The ability to attach context to a logger is a powerful one. Where should you do it and why? The ability to attach context to a logger is a powerful one. Where should you do it and why?
I favor embedding a Logger directly into any persistent object in my application and adding I favor embedding a Logger directly into any persistent object in my application and adding
@ -298,7 +293,7 @@ Tab example, we would prefer to set up our Logger like so:
Now we'll have a unique traceable identifier even across loading new urls, but Now we'll have a unique traceable identifier even across loading new urls, but
we'll still be able to see the tab's current url in the log messages. we'll still be able to see the tab's current url in the log messages.
Must # Must
For all Handler functions which can return an error, there is a version of that For all Handler functions which can return an error, there is a version of that
function which will return no error but panics on failure. They are all available function which will return no error but panics on failure. They are all available
@ -307,7 +302,7 @@ on the Must object. For example:
log.Must.FileHandler("/path", log.JSONFormat) log.Must.FileHandler("/path", log.JSONFormat)
log.Must.NetHandler("tcp", ":1234", log.JSONFormat) log.Must.NetHandler("tcp", ":1234", log.JSONFormat)
Inspiration and Credit # Inspiration and Credit
All of the following excellent projects inspired the design of this library: All of the following excellent projects inspired the design of this library:
@ -325,9 +320,8 @@ github.com/spacemonkeygo/spacelog
golang's stdlib, notably io and net/http golang's stdlib, notably io and net/http
The Name # The Name
https://xkcd.com/927/ https://xkcd.com/927/
*/ */
package log package log

View file

@ -84,7 +84,6 @@ type TerminalStringer interface {
// Example: // Example:
// //
// [DBUG] [May 16 20:58:45] remove route ns=haproxy addr=127.0.0.1:50002 // [DBUG] [May 16 20:58:45] remove route ns=haproxy addr=127.0.0.1:50002
//
func TerminalFormat(usecolor bool) Format { func TerminalFormat(usecolor bool) Format {
return FormatFunc(func(r *Record) []byte { return FormatFunc(func(r *Record) []byte {
var color = 0 var color = 0
@ -149,7 +148,6 @@ func TerminalFormat(usecolor bool) Format {
// format for key/value pairs. // format for key/value pairs.
// //
// For more details see: http://godoc.org/github.com/kr/logfmt // For more details see: http://godoc.org/github.com/kr/logfmt
//
func LogfmtFormat() Format { func LogfmtFormat() Format {
return FormatFunc(func(r *Record) []byte { return FormatFunc(func(r *Record) []byte {
common := []interface{}{r.KeyNames.Time, r.Time, r.KeyNames.Lvl, r.Lvl, r.KeyNames.Msg, r.Msg} common := []interface{}{r.KeyNames.Time, r.Time, r.KeyNames.Lvl, r.Lvl, r.KeyNames.Msg, r.Msg}

View file

@ -143,7 +143,6 @@ func CallerStackHandler(format string, h Handler) Handler {
// } // }
// return false // return false
// }, h)) // }, h))
//
func FilterHandler(fn func(r *Record) bool, h Handler) Handler { func FilterHandler(fn func(r *Record) bool, h Handler) Handler {
return FuncHandler(func(r *Record) error { return FuncHandler(func(r *Record) error {
if fn(r) { if fn(r) {
@ -159,7 +158,6 @@ func FilterHandler(fn func(r *Record) bool, h Handler) Handler {
// from your ui package: // from your ui package:
// //
// log.MatchFilterHandler("pkg", "app/ui", log.StdoutHandler) // log.MatchFilterHandler("pkg", "app/ui", log.StdoutHandler)
//
func MatchFilterHandler(key string, value interface{}, h Handler) Handler { func MatchFilterHandler(key string, value interface{}, h Handler) Handler {
return FilterHandler(func(r *Record) (pass bool) { return FilterHandler(func(r *Record) (pass bool) {
switch key { switch key {
@ -186,7 +184,6 @@ func MatchFilterHandler(key string, value interface{}, h Handler) Handler {
// log Error/Crit records: // log Error/Crit records:
// //
// log.LvlFilterHandler(log.LvlError, log.StdoutHandler) // log.LvlFilterHandler(log.LvlError, log.StdoutHandler)
//
func LvlFilterHandler(maxLvl Lvl, h Handler) Handler { func LvlFilterHandler(maxLvl Lvl, h Handler) Handler {
return FilterHandler(func(r *Record) (pass bool) { return FilterHandler(func(r *Record) (pass bool) {
return r.Lvl <= maxLvl return r.Lvl <= maxLvl
@ -201,7 +198,6 @@ func LvlFilterHandler(maxLvl Lvl, h Handler) Handler {
// log.MultiHandler( // log.MultiHandler(
// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()), // log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()),
// log.StderrHandler) // log.StderrHandler)
//
func MultiHandler(hs ...Handler) Handler { func MultiHandler(hs ...Handler) Handler {
return FuncHandler(func(r *Record) error { return FuncHandler(func(r *Record) error {
for _, h := range hs { for _, h := range hs {

View file

@ -1,4 +1,3 @@
//
// The go-ethereum library is distributed in the hope that it will be useful, // The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

View file

@ -77,7 +77,6 @@ func (bi *BigInt) SetInt64(x int64) {
// -1 if x < 0 // -1 if x < 0
// 0 if x == 0 // 0 if x == 0
// +1 if x > 0 // +1 if x > 0
//
func (bi *BigInt) Sign() int { func (bi *BigInt) Sign() int {
return bi.bigint.Sign() return bi.bigint.Sign()
} }

View file

@ -20,7 +20,7 @@
// with pieces plucked from go-ethereum, rather to allow writing native dapps on // with pieces plucked from go-ethereum, rather to allow writing native dapps on
// mobile platforms. Keep this in mind when using or extending this package! // mobile platforms. Keep this in mind when using or extending this package!
// //
// API limitations // # API limitations
// //
// Since gomobile cannot bridge arbitrary types between Go and Android/iOS, the // Since gomobile cannot bridge arbitrary types between Go and Android/iOS, the
// exposed APIs need to be manually wrapped into simplified types, with custom // exposed APIs need to be manually wrapped into simplified types, with custom

View file

@ -21,13 +21,11 @@ In the model exposed by this package, a node is a collection of services which u
resources to provide RPC APIs. Services can also offer devp2p protocols, which are wired resources to provide RPC APIs. Services can also offer devp2p protocols, which are wired
up to the devp2p network when the node instance is started. up to the devp2p network when the node instance is started.
# Node Lifecycle
Node Lifecycle
The Node object has a lifecycle consisting of three basic states, INITIALIZING, RUNNING The Node object has a lifecycle consisting of three basic states, INITIALIZING, RUNNING
and CLOSED. and CLOSED.
New() New()
@ -40,7 +38,6 @@ and CLOSED.
CLOSED Close() CLOSED Close()
Creating a Node allocates basic resources such as the data directory and returns the node Creating a Node allocates basic resources such as the data directory and returns the node
in its INITIALIZING state. Lifecycle objects, RPC APIs and peer-to-peer networking in its INITIALIZING state. Lifecycle objects, RPC APIs and peer-to-peer networking
protocols can be registered in this state. Basic operations such as opening a key-value protocols can be registered in this state. Basic operations such as opening a key-value
@ -58,8 +55,7 @@ objects and shuts down RPC and peer-to-peer networking.
You must always call Close on Node, even if the node was not started. You must always call Close on Node, even if the node was not started.
# Resources Managed By Node
Resources Managed By Node
All file-system resources used by a node instance are located in a directory called the All file-system resources used by a node instance are located in a directory called the
data directory. The location of each resource can be overridden through additional node data directory. The location of each resource can be overridden through additional node
@ -83,8 +79,7 @@ without a data directory, databases are opened in memory instead.
Node also creates the shared store of encrypted Ethereum account keys. Services can access Node also creates the shared store of encrypted Ethereum account keys. Services can access
the account manager through the service context. the account manager through the service context.
# Sharing Data Directory Among Instances
Sharing Data Directory Among Instances
Multiple node instances can share a single data directory if they have distinct instance Multiple node instances can share a single data directory if they have distinct instance
names (set through the Name config option). Sharing behaviour depends on the type of names (set through the Name config option). Sharing behaviour depends on the type of
@ -102,8 +97,7 @@ create one database for each instance.
The account key store is shared among all node instances using the same data directory The account key store is shared among all node instances using the same data directory
unless its location is changed through the KeyStoreDir configuration option. unless its location is changed through the KeyStoreDir configuration option.
# Data Directory Sharing Example
Data Directory Sharing Example
In this example, two node instances named A and B are started with the same data In this example, two node instances named A and B are started with the same data
directory. Node instance A opens the database "db", node instance B opens the databases directory. Node instance A opens the database "db", node instance B opens the databases

View file

@ -90,7 +90,6 @@ var (
// - dynamic dials are created from node discovery results. The dialer // - dynamic dials are created from node discovery results. The dialer
// continuously reads candidate nodes from its input iterator and attempts // continuously reads candidate nodes from its input iterator and attempts
// to create peer connections to nodes arriving through the iterator. // to create peer connections to nodes arriving through the iterator.
//
type dialScheduler struct { type dialScheduler struct {
dialConfig dialConfig
setupFunc dialSetupFunc setupFunc dialSetupFunc

View file

@ -41,7 +41,6 @@ import (
// To regenerate discv5 test vectors, run // To regenerate discv5 test vectors, run
// //
// go test -run TestVectors -write-test-vectors // go test -run TestVectors -write-test-vectors
//
var writeTestVectorsFlag = flag.Bool("write-test-vectors", false, "Overwrite discv5 test vectors in testdata/") var writeTestVectorsFlag = flag.Bool("write-test-vectors", false, "Overwrite discv5 test vectors in testdata/")
var ( var (

View file

@ -19,7 +19,7 @@
// stored in key/value pairs. To store and retrieve key/values in a record, use the Entry // stored in key/value pairs. To store and retrieve key/values in a record, use the Entry
// interface. // interface.
// //
// Signature Handling // # Signature Handling
// //
// Records must be signed before transmitting them to another node. // Records must be signed before transmitting them to another node.
// //

View file

@ -113,7 +113,6 @@ func Send(w MsgWriter, msgcode uint64, data interface{}) error {
// the message payload will be an RLP list containing the items: // the message payload will be an RLP list containing the items:
// //
// [e1, e2, e3] // [e1, e2, e3]
//
func SendItems(w MsgWriter, msgcode uint64, elems ...interface{}) error { func SendItems(w MsgWriter, msgcode uint64, elems ...interface{}) error {
return Send(w, msgcode, elems) return Send(w, msgcode, elems)
} }

View file

@ -43,7 +43,6 @@ import (
// * SimNode - An in-memory node // * SimNode - An in-memory node
// * ExecNode - A child process node // * ExecNode - A child process node
// * DockerNode - A Docker container node // * DockerNode - A Docker container node
//
type Node interface { type Node interface {
// Addr returns the node's address (e.g. an Enode URL) // Addr returns the node's address (e.g. an Enode URL)
Addr() []byte Addr() []byte

View file

@ -20,7 +20,6 @@ package params
// Example: To get the wei value of an amount in 'gwei', use // Example: To get the wei value of an amount in 'gwei', use
// //
// new(big.Int).Mul(value, big.NewInt(params.GWei)) // new(big.Int).Mul(value, big.NewInt(params.GWei))
//
const ( const (
Wei = 1 Wei = 1
GWei = 1e9 GWei = 1e9

View file

@ -27,8 +27,7 @@ value zero equivalent to the empty string).
RLP values are distinguished by a type tag. The type tag precedes the value in the input RLP values are distinguished by a type tag. The type tag precedes the value in the input
stream and defines the size and kind of the bytes that follow. stream and defines the size and kind of the bytes that follow.
# Encoding Rules
Encoding Rules
Package rlp uses reflection and encodes RLP based on the Go type of the value. Package rlp uses reflection and encodes RLP based on the Go type of the value.
@ -58,8 +57,7 @@ An interface value encodes as the value contained in the interface.
Floating point numbers, maps, channels and functions are not supported. Floating point numbers, maps, channels and functions are not supported.
# Decoding Rules
Decoding Rules
Decoding uses the following type-dependent rules: Decoding uses the following type-dependent rules:
@ -99,8 +97,7 @@ To decode into an interface value, one of these types is stored in the value:
Non-empty interface types are not supported when decoding. Non-empty interface types are not supported when decoding.
Signed integers, floating point numbers, maps, channels and functions cannot be decoded into. Signed integers, floating point numbers, maps, channels and functions cannot be decoded into.
# Struct Tags
Struct Tags
As with other encoding packages, the "-" tag ignores fields. As with other encoding packages, the "-" tag ignores fields.

View file

@ -15,7 +15,6 @@
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
/* /*
Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports. Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports.
It provides access to the exported methods of an object across a network or other I/O It provides access to the exported methods of an object across a network or other I/O
@ -23,7 +22,7 @@ connection. After creating a server or client instance, objects can be registere
them visible as 'services'. Exported methods that follow specific conventions can be them visible as 'services'. Exported methods that follow specific conventions can be
called remotely. It also has support for the publish/subscribe pattern. called remotely. It also has support for the publish/subscribe pattern.
RPC Methods # RPC Methods
Methods that satisfy the following criteria are made available for remote access: Methods that satisfy the following criteria are made available for remote access:
@ -75,7 +74,7 @@ An example server which uses the JSON codec:
l, _ := net.ListenUnix("unix", &net.UnixAddr{Net: "unix", Name: "/tmp/calculator.sock"}) l, _ := net.ListenUnix("unix", &net.UnixAddr{Net: "unix", Name: "/tmp/calculator.sock"})
server.ServeListener(l) server.ServeListener(l)
Subscriptions # Subscriptions
The package also supports the publish subscribe pattern through the use of subscriptions. The package also supports the publish subscribe pattern through the use of subscriptions.
A method that is considered eligible for notifications must satisfy the following A method that is considered eligible for notifications must satisfy the following
@ -101,7 +100,7 @@ the client and server. The server will close the connection for any write error.
For more information about subscriptions, see https://github.com/scroll-tech/go-ethereum/wiki/RPC-PUB-SUB. For more information about subscriptions, see https://github.com/scroll-tech/go-ethereum/wiki/RPC-PUB-SUB.
Reverse Calls # Reverse Calls
In any method handler, an instance of rpc.Client can be accessed through the In any method handler, an instance of rpc.Client can be accessed through the
ClientFromContext method. Using this client instance, server-to-client method calls can be ClientFromContext method. Using this client instance, server-to-client method calls can be

View file

@ -48,7 +48,6 @@ import (
// if err := op.wait(...); err != nil { // if err := op.wait(...); err != nil {
// h.removeRequestOp(op) // timeout, etc. // h.removeRequestOp(op) // timeout, etc.
// } // }
//
type handler struct { type handler struct {
reg *serviceRegistry reg *serviceRegistry
unsubscribeCb *callback unsubscribeCb *callback

View file

@ -147004,11 +147004,13 @@ var _bindata = map[string]func() (*asset, error){
// directory embedded in the file by go-bindata. // directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the // For example if you run go-bindata on data/... and data contains the
// following hierarchy: // following hierarchy:
//
// data/ // data/
// foo.txt // foo.txt
// img/ // img/
// a.png // a.png
// b.png // b.png
//
// then AssetDir("data") would return []string{"foo.txt", "img"}, // then AssetDir("data") would return []string{"foo.txt", "img"},
// AssetDir("data/img") would return []string{"a.png", "b.png"}, // AssetDir("data/img") would return []string{"a.png", "b.png"},
// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and // AssetDir("foo.txt") and AssetDir("notexist") would return an error, and

View file

@ -174,7 +174,8 @@ func (t *BlockTest) genesis(config *params.ChainConfig) *core.Genesis {
} }
} }
/* See https://github.com/ethereum/tests/wiki/Blockchain-Tests-II /*
See https://github.com/ethereum/tests/wiki/Blockchain-Tests-II
Whether a block is valid or not is a bit subtle, it's defined by presence of Whether a block is valid or not is a bit subtle, it's defined by presence of
blockHeader, transactions and uncleHeaders fields. If they are missing, the block is blockHeader, transactions and uncleHeaders fields. If they are missing, the block is

View file

@ -72,8 +72,10 @@ func checkInput(id byte, inputLen int) bool {
// The fuzzer functions must return // The fuzzer functions must return
// 1 if the fuzzer should increase priority of the // 1 if the fuzzer should increase priority of the
//
// given input during subsequent fuzzing (for example, the input is lexically // given input during subsequent fuzzing (for example, the input is lexically
// correct and was parsed successfully); // correct and was parsed successfully);
//
// -1 if the input must not be added to corpus even if gives new coverage; and // -1 if the input must not be added to corpus even if gives new coverage; and
// 0 otherwise // 0 otherwise
// other values are reserved for future use. // other values are reserved for future use.

View file

@ -69,8 +69,10 @@ func (f *fuzzer) readBool() bool {
// The function must return // The function must return
// 1 if the fuzzer should increase priority of the // 1 if the fuzzer should increase priority of the
//
// given input during subsequent fuzzing (for example, the input is lexically // given input during subsequent fuzzing (for example, the input is lexically
// correct and was parsed successfully); // correct and was parsed successfully);
//
// -1 if the input must not be added to corpus even if gives new coverage; and // -1 if the input must not be added to corpus even if gives new coverage; and
// 0 otherwise // 0 otherwise
// other values are reserved for future use. // other values are reserved for future use.

View file

@ -182,8 +182,10 @@ func (f *fuzzer) fuzz() int {
// The function must return // The function must return
// 1 if the fuzzer should increase priority of the // 1 if the fuzzer should increase priority of the
//
// given input during subsequent fuzzing (for example, the input is lexically // given input during subsequent fuzzing (for example, the input is lexically
// correct and was parsed successfully); // correct and was parsed successfully);
//
// -1 if the input must not be added to corpus even if gives new coverage; and // -1 if the input must not be added to corpus even if gives new coverage; and
// 0 otherwise; other values are reserved for future use. // 0 otherwise; other values are reserved for future use.
func Fuzz(input []byte) int { func Fuzz(input []byte) int {

View file

@ -115,8 +115,10 @@ func (k kvs) Swap(i, j int) {
// The function must return // The function must return
// 1 if the fuzzer should increase priority of the // 1 if the fuzzer should increase priority of the
//
// given input during subsequent fuzzing (for example, the input is lexically // given input during subsequent fuzzing (for example, the input is lexically
// correct and was parsed successfully); // correct and was parsed successfully);
//
// -1 if the input must not be added to corpus even if gives new coverage; and // -1 if the input must not be added to corpus even if gives new coverage; and
// 0 otherwise // 0 otherwise
// other values are reserved for future use. // other values are reserved for future use.

View file

@ -124,8 +124,10 @@ func Generate(input []byte) randTest {
// The function must return // The function must return
// 1 if the fuzzer should increase priority of the // 1 if the fuzzer should increase priority of the
//
// given input during subsequent fuzzing (for example, the input is lexically // given input during subsequent fuzzing (for example, the input is lexically
// correct and was parsed successfully); // correct and was parsed successfully);
//
// -1 if the input must not be added to corpus even if gives new coverage; and // -1 if the input must not be added to corpus even if gives new coverage; and
// 0 otherwise // 0 otherwise
// other values are reserved for future use. // other values are reserved for future use.

View file

@ -365,6 +365,7 @@ func (st *StackTrie) insert(key, value []byte) {
// 1. The rlp-encoded value was >= 32 bytes: // 1. The rlp-encoded value was >= 32 bytes:
// - Then the 32-byte `hash` will be accessible in `st.val`. // - Then the 32-byte `hash` will be accessible in `st.val`.
// - And the 'st.type' will be 'hashedNode' // - And the 'st.type' will be 'hashedNode'
//
// 2. The rlp-encoded value was < 32 bytes // 2. The rlp-encoded value was < 32 bytes
// - Then the <32 byte rlp-encoded value will be accessible in 'st.val'. // - Then the <32 byte rlp-encoded value will be accessible in 'st.val'.
// - And the 'st.type' will be 'hashedNode' AGAIN // - And the 'st.type' will be 'hashedNode' AGAIN