mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
style: revert some formatting (#294)
Revert "style: remove blank line & white space formatting" This reverts commit 349def8d5d78f83c19e899d5d80b1d9f6a5d18c6.
This commit is contained in:
parent
09c69b6076
commit
32aacc3fd6
95 changed files with 775 additions and 818 deletions
|
|
@ -165,7 +165,6 @@ 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{}
|
||||||
// }
|
// }
|
||||||
|
|
@ -725,7 +724,6 @@ 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);
|
||||||
|
|
@ -734,9 +732,7 @@ 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"}]`
|
||||||
|
|
@ -1084,7 +1080,6 @@ 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();
|
||||||
|
|
@ -1113,7 +1108,6 @@ 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);
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -1015,7 +1015,6 @@ 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)
|
||||||
|
|
@ -1227,11 +1226,10 @@ 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(); }
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
const callableAbi = "[{\"anonymous\":false,\"inputs\":[],\"name\":\"Called\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"Call\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
|
const callableAbi = "[{\"anonymous\":false,\"inputs\":[],\"name\":\"Called\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"Call\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
|
||||||
|
|
||||||
|
|
@ -1249,7 +1247,6 @@ 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)
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,11 @@ 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{} {
|
||||||
|
|
@ -173,14 +171,10 @@ 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()
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,6 @@ 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.
|
||||||
|
|
@ -191,7 +190,6 @@ 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.
|
||||||
|
|
|
||||||
|
|
@ -880,7 +880,6 @@ 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)
|
||||||
|
|
@ -996,7 +995,6 @@ 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"`
|
||||||
|
|
@ -1004,7 +1002,6 @@ 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)
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ 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)
|
||||||
|
|
|
||||||
|
|
@ -407,6 +407,8 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ func (Failure_FailureType) EnumDescriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_aaf30d059fdbc38d, []int{1, 0}
|
return fileDescriptor_aaf30d059fdbc38d, []int{1, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Type of button request
|
// Type of button request
|
||||||
type ButtonRequest_ButtonRequestType int32
|
type ButtonRequest_ButtonRequestType int32
|
||||||
|
|
||||||
|
|
@ -175,7 +175,7 @@ func (ButtonRequest_ButtonRequestType) EnumDescriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_aaf30d059fdbc38d, []int{2, 0}
|
return fileDescriptor_aaf30d059fdbc38d, []int{2, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Type of PIN request
|
// Type of PIN request
|
||||||
type PinMatrixRequest_PinMatrixRequestType int32
|
type PinMatrixRequest_PinMatrixRequestType int32
|
||||||
|
|
||||||
|
|
@ -220,7 +220,7 @@ func (PinMatrixRequest_PinMatrixRequestType) EnumDescriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_aaf30d059fdbc38d, []int{4, 0}
|
return fileDescriptor_aaf30d059fdbc38d, []int{4, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Success of the previous request
|
// Response: Success of the previous request
|
||||||
// @end
|
// @end
|
||||||
type Success struct {
|
type Success struct {
|
||||||
|
|
@ -262,7 +262,7 @@ func (m *Success) GetMessage() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Failure of the previous request
|
// Response: Failure of the previous request
|
||||||
// @end
|
// @end
|
||||||
type Failure struct {
|
type Failure struct {
|
||||||
|
|
@ -312,7 +312,7 @@ func (m *Failure) GetMessage() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Device is waiting for HW button press.
|
// Response: Device is waiting for HW button press.
|
||||||
// @auxstart
|
// @auxstart
|
||||||
// @next ButtonAck
|
// @next ButtonAck
|
||||||
|
|
@ -363,7 +363,7 @@ func (m *ButtonRequest) GetData() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Computer agrees to wait for HW button press
|
// Request: Computer agrees to wait for HW button press
|
||||||
// @auxend
|
// @auxend
|
||||||
type ButtonAck struct {
|
type ButtonAck struct {
|
||||||
|
|
@ -397,7 +397,7 @@ func (m *ButtonAck) XXX_DiscardUnknown() {
|
||||||
|
|
||||||
var xxx_messageInfo_ButtonAck proto.InternalMessageInfo
|
var xxx_messageInfo_ButtonAck proto.InternalMessageInfo
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Device is asking computer to show PIN matrix and awaits PIN encoded using this matrix scheme
|
// Response: Device is asking computer to show PIN matrix and awaits PIN encoded using this matrix scheme
|
||||||
// @auxstart
|
// @auxstart
|
||||||
// @next PinMatrixAck
|
// @next PinMatrixAck
|
||||||
|
|
@ -440,7 +440,7 @@ func (m *PinMatrixRequest) GetType() PinMatrixRequest_PinMatrixRequestType {
|
||||||
return PinMatrixRequest_PinMatrixRequestType_Current
|
return PinMatrixRequest_PinMatrixRequestType_Current
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Computer responds with encoded PIN
|
// Request: Computer responds with encoded PIN
|
||||||
// @auxend
|
// @auxend
|
||||||
type PinMatrixAck struct {
|
type PinMatrixAck struct {
|
||||||
|
|
@ -482,7 +482,7 @@ func (m *PinMatrixAck) GetPin() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Device awaits encryption passphrase
|
// Response: Device awaits encryption passphrase
|
||||||
// @auxstart
|
// @auxstart
|
||||||
// @next PassphraseAck
|
// @next PassphraseAck
|
||||||
|
|
@ -525,7 +525,7 @@ func (m *PassphraseRequest) GetOnDevice() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Send passphrase back
|
// Request: Send passphrase back
|
||||||
// @next PassphraseStateRequest
|
// @next PassphraseStateRequest
|
||||||
type PassphraseAck struct {
|
type PassphraseAck struct {
|
||||||
|
|
@ -575,7 +575,7 @@ func (m *PassphraseAck) GetState() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Device awaits passphrase state
|
// Response: Device awaits passphrase state
|
||||||
// @next PassphraseStateAck
|
// @next PassphraseStateAck
|
||||||
type PassphraseStateRequest struct {
|
type PassphraseStateRequest struct {
|
||||||
|
|
@ -617,7 +617,7 @@ func (m *PassphraseStateRequest) GetState() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Send passphrase state back
|
// Request: Send passphrase state back
|
||||||
// @auxend
|
// @auxend
|
||||||
type PassphraseStateAck struct {
|
type PassphraseStateAck struct {
|
||||||
|
|
@ -651,7 +651,7 @@ func (m *PassphraseStateAck) XXX_DiscardUnknown() {
|
||||||
|
|
||||||
var xxx_messageInfo_PassphraseStateAck proto.InternalMessageInfo
|
var xxx_messageInfo_PassphraseStateAck proto.InternalMessageInfo
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Structure representing BIP32 (hierarchical deterministic) node
|
// Structure representing BIP32 (hierarchical deterministic) node
|
||||||
// Used for imports of private key into the device and exporting public key out of device
|
// Used for imports of private key into the device and exporting public key out of device
|
||||||
// @embed
|
// @embed
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ var _ = math.Inf
|
||||||
// proto package needs to be updated.
|
// proto package needs to be updated.
|
||||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Ask device for public key corresponding to address_n path
|
// Request: Ask device for public key corresponding to address_n path
|
||||||
// @start
|
// @start
|
||||||
// @next EthereumPublicKey
|
// @next EthereumPublicKey
|
||||||
|
|
@ -73,7 +73,7 @@ func (m *EthereumGetPublicKey) GetShowDisplay() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Contains public key derived from device private seed
|
// Response: Contains public key derived from device private seed
|
||||||
// @end
|
// @end
|
||||||
type EthereumPublicKey struct {
|
type EthereumPublicKey struct {
|
||||||
|
|
@ -123,7 +123,7 @@ func (m *EthereumPublicKey) GetXpub() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Ask device for Ethereum address corresponding to address_n path
|
// Request: Ask device for Ethereum address corresponding to address_n path
|
||||||
// @start
|
// @start
|
||||||
// @next EthereumAddress
|
// @next EthereumAddress
|
||||||
|
|
@ -175,7 +175,7 @@ func (m *EthereumGetAddress) GetShowDisplay() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Contains an Ethereum address derived from device private seed
|
// Response: Contains an Ethereum address derived from device private seed
|
||||||
// @end
|
// @end
|
||||||
type EthereumAddress struct {
|
type EthereumAddress struct {
|
||||||
|
|
@ -225,7 +225,7 @@ func (m *EthereumAddress) GetAddressHex() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Ask device to sign transaction
|
// Request: Ask device to sign transaction
|
||||||
// All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
|
// All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
|
||||||
// Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
|
// Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
|
||||||
|
|
@ -351,7 +351,7 @@ func (m *EthereumSignTx) GetTxType() uint32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Device asks for more data from transaction payload, or returns the signature.
|
// Response: Device asks for more data from transaction payload, or returns the signature.
|
||||||
// If data_length is set, device awaits that many more bytes of payload.
|
// If data_length is set, device awaits that many more bytes of payload.
|
||||||
// Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
|
// Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
|
||||||
|
|
@ -420,7 +420,7 @@ func (m *EthereumTxRequest) GetSignatureS() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Transaction payload data.
|
// Request: Transaction payload data.
|
||||||
// @next EthereumTxRequest
|
// @next EthereumTxRequest
|
||||||
type EthereumTxAck struct {
|
type EthereumTxAck struct {
|
||||||
|
|
@ -462,7 +462,7 @@ func (m *EthereumTxAck) GetDataChunk() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Ask device to sign message
|
// Request: Ask device to sign message
|
||||||
// @start
|
// @start
|
||||||
// @next EthereumMessageSignature
|
// @next EthereumMessageSignature
|
||||||
|
|
@ -514,7 +514,7 @@ func (m *EthereumSignMessage) GetMessage() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Signed message
|
// Response: Signed message
|
||||||
// @end
|
// @end
|
||||||
type EthereumMessageSignature struct {
|
type EthereumMessageSignature struct {
|
||||||
|
|
@ -572,7 +572,7 @@ func (m *EthereumMessageSignature) GetAddressHex() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Ask device to verify message
|
// Request: Ask device to verify message
|
||||||
// @start
|
// @start
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ var _ = math.Inf
|
||||||
// proto package needs to be updated.
|
// proto package needs to be updated.
|
||||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Structure representing passphrase source
|
// Structure representing passphrase source
|
||||||
type ApplySettings_PassphraseSourceType int32
|
type ApplySettings_PassphraseSourceType int32
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ func (ApplySettings_PassphraseSourceType) EnumDescriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_0c720c20d27aa029, []int{4, 0}
|
return fileDescriptor_0c720c20d27aa029, []int{4, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Type of recovery procedure. These should be used as bitmask, e.g.,
|
// Type of recovery procedure. These should be used as bitmask, e.g.,
|
||||||
// `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix`
|
// `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix`
|
||||||
// listing every method supported by the host computer.
|
// listing every method supported by the host computer.
|
||||||
|
|
@ -114,7 +114,7 @@ func (RecoveryDevice_RecoveryDeviceType) EnumDescriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_0c720c20d27aa029, []int{17, 0}
|
return fileDescriptor_0c720c20d27aa029, []int{17, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Type of Recovery Word request
|
// Type of Recovery Word request
|
||||||
type WordRequest_WordRequestType int32
|
type WordRequest_WordRequestType int32
|
||||||
|
|
||||||
|
|
@ -159,7 +159,7 @@ func (WordRequest_WordRequestType) EnumDescriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_0c720c20d27aa029, []int{18, 0}
|
return fileDescriptor_0c720c20d27aa029, []int{18, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Reset device to default state and ask for device details
|
// Request: Reset device to default state and ask for device details
|
||||||
// @start
|
// @start
|
||||||
// @next Features
|
// @next Features
|
||||||
|
|
@ -210,7 +210,7 @@ func (m *Initialize) GetSkipPassphrase() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Ask for device details (no device reset)
|
// Request: Ask for device details (no device reset)
|
||||||
// @start
|
// @start
|
||||||
// @next Features
|
// @next Features
|
||||||
|
|
@ -245,7 +245,7 @@ func (m *GetFeatures) XXX_DiscardUnknown() {
|
||||||
|
|
||||||
var xxx_messageInfo_GetFeatures proto.InternalMessageInfo
|
var xxx_messageInfo_GetFeatures proto.InternalMessageInfo
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Reports various information about the device
|
// Response: Reports various information about the device
|
||||||
// @end
|
// @end
|
||||||
type Features struct {
|
type Features struct {
|
||||||
|
|
@ -495,7 +495,7 @@ func (m *Features) GetNoBackup() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: clear session (removes cached PIN, passphrase, etc).
|
// Request: clear session (removes cached PIN, passphrase, etc).
|
||||||
// @start
|
// @start
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
@ -530,7 +530,7 @@ func (m *ClearSession) XXX_DiscardUnknown() {
|
||||||
|
|
||||||
var xxx_messageInfo_ClearSession proto.InternalMessageInfo
|
var xxx_messageInfo_ClearSession proto.InternalMessageInfo
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: change language and/or label of the device
|
// Request: change language and/or label of the device
|
||||||
// @start
|
// @start
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
@ -622,7 +622,7 @@ func (m *ApplySettings) GetDisplayRotation() uint32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: set flags of the device
|
// Request: set flags of the device
|
||||||
// @start
|
// @start
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
@ -666,7 +666,7 @@ func (m *ApplyFlags) GetFlags() uint32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Starts workflow for setting/changing/removing the PIN
|
// Request: Starts workflow for setting/changing/removing the PIN
|
||||||
// @start
|
// @start
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
@ -710,7 +710,7 @@ func (m *ChangePin) GetRemove() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Test if the device is alive, device sends back the message in Success response
|
// Request: Test if the device is alive, device sends back the message in Success response
|
||||||
// @start
|
// @start
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
@ -777,7 +777,7 @@ func (m *Ping) GetPassphraseProtection() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Abort last operation that required user interaction
|
// Request: Abort last operation that required user interaction
|
||||||
// @start
|
// @start
|
||||||
// @next Failure
|
// @next Failure
|
||||||
|
|
@ -812,7 +812,7 @@ func (m *Cancel) XXX_DiscardUnknown() {
|
||||||
|
|
||||||
var xxx_messageInfo_Cancel proto.InternalMessageInfo
|
var xxx_messageInfo_Cancel proto.InternalMessageInfo
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Request a sample of random data generated by hardware RNG. May be used for testing.
|
// Request: Request a sample of random data generated by hardware RNG. May be used for testing.
|
||||||
// @start
|
// @start
|
||||||
// @next Entropy
|
// @next Entropy
|
||||||
|
|
@ -856,7 +856,7 @@ func (m *GetEntropy) GetSize() uint32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Reply with random data generated by internal RNG
|
// Response: Reply with random data generated by internal RNG
|
||||||
// @end
|
// @end
|
||||||
type Entropy struct {
|
type Entropy struct {
|
||||||
|
|
@ -898,7 +898,7 @@ func (m *Entropy) GetEntropy() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Request device to wipe all sensitive data and settings
|
// Request: Request device to wipe all sensitive data and settings
|
||||||
// @start
|
// @start
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
@ -934,7 +934,7 @@ func (m *WipeDevice) XXX_DiscardUnknown() {
|
||||||
|
|
||||||
var xxx_messageInfo_WipeDevice proto.InternalMessageInfo
|
var xxx_messageInfo_WipeDevice proto.InternalMessageInfo
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Load seed and related internal settings from the computer
|
// Request: Load seed and related internal settings from the computer
|
||||||
// @start
|
// @start
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
@ -1036,7 +1036,7 @@ func (m *LoadDevice) GetU2FCounter() uint32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Ask device to do initialization involving user interaction
|
// Request: Ask device to do initialization involving user interaction
|
||||||
// @start
|
// @start
|
||||||
// @next EntropyRequest
|
// @next EntropyRequest
|
||||||
|
|
@ -1147,7 +1147,7 @@ func (m *ResetDevice) GetNoBackup() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Perform backup of the device seed if not backed up using ResetDevice
|
// Request: Perform backup of the device seed if not backed up using ResetDevice
|
||||||
// @start
|
// @start
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
@ -1182,7 +1182,7 @@ func (m *BackupDevice) XXX_DiscardUnknown() {
|
||||||
|
|
||||||
var xxx_messageInfo_BackupDevice proto.InternalMessageInfo
|
var xxx_messageInfo_BackupDevice proto.InternalMessageInfo
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Ask for additional entropy from host computer
|
// Response: Ask for additional entropy from host computer
|
||||||
// @next EntropyAck
|
// @next EntropyAck
|
||||||
type EntropyRequest struct {
|
type EntropyRequest struct {
|
||||||
|
|
@ -1216,7 +1216,7 @@ func (m *EntropyRequest) XXX_DiscardUnknown() {
|
||||||
|
|
||||||
var xxx_messageInfo_EntropyRequest proto.InternalMessageInfo
|
var xxx_messageInfo_EntropyRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Provide additional entropy for seed generation function
|
// Request: Provide additional entropy for seed generation function
|
||||||
// @next Success
|
// @next Success
|
||||||
type EntropyAck struct {
|
type EntropyAck struct {
|
||||||
|
|
@ -1258,7 +1258,7 @@ func (m *EntropyAck) GetEntropy() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Start recovery workflow asking user for specific words of mnemonic
|
// Request: Start recovery workflow asking user for specific words of mnemonic
|
||||||
// Used to recovery device safely even on untrusted computer.
|
// Used to recovery device safely even on untrusted computer.
|
||||||
// @start
|
// @start
|
||||||
|
|
@ -1369,7 +1369,7 @@ func (m *RecoveryDevice) GetDryRun() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Response: Device is waiting for user to enter word of the mnemonic
|
// Response: Device is waiting for user to enter word of the mnemonic
|
||||||
// Its position is shown only on device's internal display.
|
// Its position is shown only on device's internal display.
|
||||||
// @next WordAck
|
// @next WordAck
|
||||||
|
|
@ -1412,7 +1412,7 @@ func (m *WordRequest) GetType() WordRequest_WordRequestType {
|
||||||
return WordRequest_WordRequestType_Plain
|
return WordRequest_WordRequestType_Plain
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Computer replies with word from the mnemonic
|
// Request: Computer replies with word from the mnemonic
|
||||||
// @next WordRequest
|
// @next WordRequest
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
@ -1456,7 +1456,7 @@ func (m *WordAck) GetWord() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Request: Set U2F counter
|
// Request: Set U2F counter
|
||||||
// @start
|
// @start
|
||||||
// @next Success
|
// @next Success
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ var _ = math.Inf
|
||||||
// proto package needs to be updated.
|
// proto package needs to be updated.
|
||||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
// *
|
//*
|
||||||
// Mapping between TREZOR wire identifier (uint) and a protobuf message
|
// Mapping between TREZOR wire identifier (uint) and a protobuf message
|
||||||
type MessageType int32
|
type MessageType int32
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import (
|
||||||
"github.com/scroll-tech/go-ethereum/params"
|
"github.com/scroll-tech/go-ethereum/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
// var faucetAddr = common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7")
|
//var faucetAddr = common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7")
|
||||||
var faucetKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
var faucetKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||||
|
|
||||||
func (s *Suite) sendSuccessfulTxs(t *utesting.T, isEth66 bool) error {
|
func (s *Suite) sendSuccessfulTxs(t *utesting.T, isEth66 bool) error {
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ 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.
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,6 @@ 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.
|
||||||
|
|
|
||||||
|
|
@ -187,13 +187,11 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
//
|
//
|
||||||
// $ p2psim node connect node01 node02
|
// $ p2psim node connect node01 node02
|
||||||
// Connected node01 to node02
|
// Connected node01 to node02
|
||||||
|
//
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
||||||
|
|
@ -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".
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ 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 {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -1867,7 +1867,6 @@ 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)))
|
||||||
|
|
@ -2650,6 +2649,7 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,12 @@
|
||||||
// +build none
|
// +build none
|
||||||
|
|
||||||
/*
|
/*
|
||||||
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.
|
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.
|
||||||
|
|
||||||
go run mkalloc.go genesis.json
|
go run mkalloc.go genesis.json
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,12 +235,10 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,8 @@ The state transitioning model does all the necessary work to work out a valid ne
|
||||||
3) Create a new state object if the recipient is \0*32
|
3) Create a new state object if the recipient is \0*32
|
||||||
4) Value transfer
|
4) Value transfer
|
||||||
== If contract creation ==
|
== If contract creation ==
|
||||||
|
|
||||||
4a) Attempt to run transaction data
|
4a) Attempt to run transaction data
|
||||||
4b) If valid, use result as code for the new state object
|
4b) If valid, use result as code for the new state object
|
||||||
|
|
||||||
== end ==
|
== end ==
|
||||||
5) Run Script section
|
5) Run Script section
|
||||||
6) Derive new state root
|
6) Derive new state root
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -391,21 +391,16 @@ 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,
|
||||||
|
|
@ -415,11 +410,9 @@ 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()
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ import (
|
||||||
"github.com/scroll-tech/go-ethereum/rlp"
|
"github.com/scroll-tech/go-ethereum/rlp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SignatureLength indicates the byte length required to carry a signature with recovery id.
|
//SignatureLength indicates the byte length required to carry a signature with recovery id.
|
||||||
const SignatureLength = 64 + 1 // 64 bytes ECDSA signature + 1 byte recovery id
|
const SignatureLength = 64 + 1 // 64 bytes ECDSA signature + 1 byte recovery id
|
||||||
|
|
||||||
// RecoveryIDOffset points to the byte offset within the signature that contains the recovery id.
|
// RecoveryIDOffset points to the byte offset within the signature that contains the recovery id.
|
||||||
|
|
|
||||||
|
|
@ -702,11 +702,9 @@ 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) {
|
||||||
|
|
|
||||||
|
|
@ -477,7 +477,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,6 @@ 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) {
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -388,13 +388,11 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ 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,
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,9 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,6 @@ 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)
|
||||||
// -------+------------+---------------+---------------+---------------+---------------
|
// -------+------------+---------------+---------------+---------------+---------------
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -741,9 +741,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)
|
||||||
|
|
|
||||||
|
|
@ -212,13 +212,11 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -366,7 +366,6 @@ 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
|
||||||
|
|
@ -385,7 +384,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -705,11 +705,9 @@ 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) {
|
||||||
|
|
|
||||||
|
|
@ -477,7 +477,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -77,11 +77,8 @@ 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 {
|
||||||
|
|
|
||||||
36
log/doc.go
36
log/doc.go
|
|
@ -13,19 +13,21 @@ 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'.
|
||||||
|
|
@ -44,7 +46,8 @@ 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
|
||||||
|
|
@ -59,7 +62,8 @@ 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:
|
||||||
|
|
@ -68,6 +72,7 @@ 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.
|
||||||
|
|
@ -85,7 +90,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
|
||||||
|
|
@ -116,7 +121,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
|
||||||
|
|
@ -141,7 +146,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.
|
||||||
|
|
@ -159,7 +164,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
|
||||||
|
|
@ -186,14 +191,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
|
||||||
|
|
@ -211,7 +216,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
|
||||||
|
|
@ -237,7 +242,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
|
||||||
|
|
@ -293,7 +298,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
|
||||||
|
|
@ -302,7 +307,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:
|
||||||
|
|
||||||
|
|
@ -320,8 +325,9 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ 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
|
||||||
|
|
@ -148,6 +149,7 @@ 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}
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,7 @@ 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) {
|
||||||
|
|
@ -158,6 +159,7 @@ 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 {
|
||||||
|
|
@ -184,6 +186,7 @@ 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
|
||||||
|
|
@ -198,6 +201,7 @@ 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 {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
//
|
||||||
// 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
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ 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()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
14
node/doc.go
14
node/doc.go
|
|
@ -21,11 +21,13 @@ 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()
|
||||||
│
|
│
|
||||||
|
|
@ -38,6 +40,7 @@ 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
|
||||||
|
|
@ -55,7 +58,8 @@ 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
|
||||||
|
|
@ -79,7 +83,8 @@ 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
|
||||||
|
|
@ -97,7 +102,8 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ 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 (
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,7 @@ 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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -29,20 +29,20 @@ import (
|
||||||
"github.com/scroll-tech/go-ethereum/p2p/simulations/adapters"
|
"github.com/scroll-tech/go-ethereum/p2p/simulations/adapters"
|
||||||
)
|
)
|
||||||
|
|
||||||
// a map of mocker names to its function
|
//a map of mocker names to its function
|
||||||
var mockerList = map[string]func(net *Network, quit chan struct{}, nodeCount int){
|
var mockerList = map[string]func(net *Network, quit chan struct{}, nodeCount int){
|
||||||
"startStop": startStop,
|
"startStop": startStop,
|
||||||
"probabilistic": probabilistic,
|
"probabilistic": probabilistic,
|
||||||
"boot": boot,
|
"boot": boot,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookup a mocker by its name, returns the mockerFn
|
//Lookup a mocker by its name, returns the mockerFn
|
||||||
func LookupMocker(mockerType string) func(net *Network, quit chan struct{}, nodeCount int) {
|
func LookupMocker(mockerType string) func(net *Network, quit chan struct{}, nodeCount int) {
|
||||||
return mockerList[mockerType]
|
return mockerList[mockerType]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a list of mockers (keys of the map)
|
//Get a list of mockers (keys of the map)
|
||||||
// Useful for frontend to build available mocker selection
|
//Useful for frontend to build available mocker selection
|
||||||
func GetMockerList() []string {
|
func GetMockerList() []string {
|
||||||
list := make([]string, 0, len(mockerList))
|
list := make([]string, 0, len(mockerList))
|
||||||
for k := range mockerList {
|
for k := range mockerList {
|
||||||
|
|
@ -51,7 +51,7 @@ func GetMockerList() []string {
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
// The boot mockerFn only connects the node in a ring and doesn't do anything else
|
//The boot mockerFn only connects the node in a ring and doesn't do anything else
|
||||||
func boot(net *Network, quit chan struct{}, nodeCount int) {
|
func boot(net *Network, quit chan struct{}, nodeCount int) {
|
||||||
_, err := connectNodesInRing(net, nodeCount)
|
_, err := connectNodesInRing(net, nodeCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -59,7 +59,7 @@ func boot(net *Network, quit chan struct{}, nodeCount int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The startStop mockerFn stops and starts nodes in a defined period (ticker)
|
//The startStop mockerFn stops and starts nodes in a defined period (ticker)
|
||||||
func startStop(net *Network, quit chan struct{}, nodeCount int) {
|
func startStop(net *Network, quit chan struct{}, nodeCount int) {
|
||||||
nodes, err := connectNodesInRing(net, nodeCount)
|
nodes, err := connectNodesInRing(net, nodeCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -96,10 +96,10 @@ func startStop(net *Network, quit chan struct{}, nodeCount int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The probabilistic mocker func has a more probabilistic pattern
|
//The probabilistic mocker func has a more probabilistic pattern
|
||||||
// (the implementation could probably be improved):
|
//(the implementation could probably be improved):
|
||||||
// nodes are connected in a ring, then a varying number of random nodes is selected,
|
//nodes are connected in a ring, then a varying number of random nodes is selected,
|
||||||
// mocker then stops and starts them in random intervals, and continues the loop
|
//mocker then stops and starts them in random intervals, and continues the loop
|
||||||
func probabilistic(net *Network, quit chan struct{}, nodeCount int) {
|
func probabilistic(net *Network, quit chan struct{}, nodeCount int) {
|
||||||
nodes, err := connectNodesInRing(net, nodeCount)
|
nodes, err := connectNodesInRing(net, nodeCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -160,7 +160,7 @@ func probabilistic(net *Network, quit chan struct{}, nodeCount int) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// connect nodeCount number of nodes in a ring
|
//connect nodeCount number of nodes in a ring
|
||||||
func connectNodesInRing(net *Network, nodeCount int) ([]enode.ID, error) {
|
func connectNodesInRing(net *Network, nodeCount int) ([]enode.ID, error) {
|
||||||
ids := make([]enode.ID, nodeCount)
|
ids := make([]enode.ID, nodeCount)
|
||||||
for i := 0; i < nodeCount; i++ {
|
for i := 0; i < nodeCount; i++ {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ var VersionWithMeta = func() string {
|
||||||
|
|
||||||
// ArchiveVersion holds the textual version string used for Geth archives.
|
// ArchiveVersion holds the textual version string used for Geth archives.
|
||||||
// e.g. "1.8.11-dea1ce05" for stable releases, or
|
// e.g. "1.8.11-dea1ce05" for stable releases, or
|
||||||
//
|
|
||||||
// "1.8.13-unstable-21c059b6" for unstable releases
|
// "1.8.13-unstable-21c059b6" for unstable releases
|
||||||
func ArchiveVersion(gitCommit string) string {
|
func ArchiveVersion(gitCommit string) string {
|
||||||
vsn := Version
|
vsn := Version
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ 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.
|
||||||
|
|
||||||
|
|
@ -57,7 +58,8 @@ 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:
|
||||||
|
|
||||||
|
|
@ -97,7 +99,8 @@ 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.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
// 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
|
||||||
|
|
@ -22,7 +23,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:
|
||||||
|
|
||||||
|
|
@ -74,7 +75,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
|
||||||
|
|
@ -100,7 +101,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
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ import (
|
||||||
"github.com/scroll-tech/go-ethereum/signer/storage"
|
"github.com/scroll-tech/go-ethereum/signer/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Used for testing
|
//Used for testing
|
||||||
type headlessUi struct {
|
type headlessUi struct {
|
||||||
approveCh chan string // to send approve/deny
|
approveCh chan string // to send approve/deny
|
||||||
inputCh chan string // to send password
|
inputCh chan string // to send password
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ func (vs *ValidationMessages) Info(msg string) {
|
||||||
vs.Messages = append(vs.Messages, ValidationInfo{INFO, msg})
|
vs.Messages = append(vs.Messages, ValidationInfo{INFO, msg})
|
||||||
}
|
}
|
||||||
|
|
||||||
// / getWarnings returns an error with all messages of type WARN of above, or nil if no warnings were present
|
/// getWarnings returns an error with all messages of type WARN of above, or nil if no warnings were present
|
||||||
func (v *ValidationMessages) GetWarnings() error {
|
func (v *ValidationMessages) GetWarnings() error {
|
||||||
var messages []string
|
var messages []string
|
||||||
for _, msg := range v.Messages {
|
for _, msg := range v.Messages {
|
||||||
|
|
|
||||||
|
|
@ -147004,13 +147004,11 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ func (d *dummyUI) OnApprovedTx(tx ethapi.SignTransactionResult) {
|
||||||
func (d *dummyUI) OnSignerStartup(info core.StartupInfo) {
|
func (d *dummyUI) OnSignerStartup(info core.StartupInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestForwarding tests that the rule-engine correctly dispatches requests to the next caller
|
//TestForwarding tests that the rule-engine correctly dispatches requests to the next caller
|
||||||
func TestForwarding(t *testing.T) {
|
func TestForwarding(t *testing.T) {
|
||||||
|
|
||||||
js := ""
|
js := ""
|
||||||
|
|
@ -544,7 +544,7 @@ func (d *dontCallMe) OnApprovedTx(tx ethapi.SignTransactionResult) {
|
||||||
d.t.Fatalf("Did not expect next-handler to be called")
|
d.t.Fatalf("Did not expect next-handler to be called")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestContextIsCleared tests that the rule-engine does not retain variables over several requests.
|
//TestContextIsCleared tests that the rule-engine does not retain variables over several requests.
|
||||||
// if it does, that would be bad since developers may rely on that to store data,
|
// if it does, that would be bad since developers may rely on that to store data,
|
||||||
// instead of using the disk-based data storage
|
// instead of using the disk-based data storage
|
||||||
func TestContextIsCleared(t *testing.T) {
|
func TestContextIsCleared(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,7 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -72,10 +72,8 @@ 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.
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,8 @@ 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.
|
||||||
|
|
|
||||||
|
|
@ -182,10 +182,8 @@ 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 {
|
||||||
|
|
|
||||||
|
|
@ -115,10 +115,8 @@ 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.
|
||||||
|
|
|
||||||
|
|
@ -124,10 +124,8 @@ 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.
|
||||||
|
|
|
||||||
|
|
@ -365,7 +365,6 @@ 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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue