mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 07:36:44 +00:00
* Milestone Implementation * Merge branch 'POS-347' into reciept-e2e-test * Changes for testing, will be removed after testing * Debugged the error * Just for testing purpose * refactor debug api methods, rename whitelist -> checkpoint * remove first iteration based vars * fix linters * Rewind Changes * Error changes * RewindBack function in bor_checkpoint_verifier * Testcases * Added the fetch test for milestone and checkpoint * Debugged the lint changes * Debugged the lint changes * Debugged the lint changes * Debugged the lint changes * Improved the error in Miner test file * Improved the error of pointing to the wrong function * Locking the sprint after the vote has been made on it. * Adding more logs for testing * Adding more logs for testing * Adding more logs for testing * Implemented the NoAckMilestone fetching mechanism * Testcases for milestone implementation * Testing code for fetchNoAckMilestone and fetchLastNoAckMilestone * Testing changes * refactor else-if * Corrected the number of params in bor_ext.go * Dummy API for testing * Defined the GetVoteOnRootHash in interface * Defined the GetVoteOnRootHash in interface * Made changes in the web3ext file * Added the GetVoteOnRootHash in PublicBlockChain API * Added the GetVoteOnRootHash in filterBackend * Added the log of Root and RooHash * Removed the 0x from rootHash * Just for testing purpose * "GetVoteOnRootHash" mock implementation * bor_test.go * Added the test for milestone implementation * Added service for fetching milestone by ID * Improved the comments * Removed the duplicate code * use setter for borVerifier * use setter for borVerifier * refactor handleNoAckMilestone * remove code repetition with retry function * Converged the repetitive code * after CR * persistence * persistence implementation * feature flag * Persistence Changes * cr * initial * fix * fix * Whitelist Flag * 1 Add:Included the milestone flag 2.Add:Hardlimit the rewind to maximum of 255 blocks * Chg:Updated go.mod file * Remove:Dubai Hardfork code * Add:checked errors for call functions to the Db, Rmv: Remote Header variable from the IsValidPeer() function * Fix:Linting issues' * Add:MilestoneGRPC functions * Fix:Lint issues * Fix:Lint issues * Fix: TestFetchMilestoneFromMockHeimdall * Fix:Integrations tests * Add:Test for sprint length and milestone changes * Add:Functionality to fetch the finalized block * Chg:Changed default val of TriesInmemory to 1024 * fix:Some functions of heimdallGRPC client * Restored the GRPC functionality, was commented out for developing purpose * Fix:Bor_checkpoint_Verfier function * Test:Added the chain Rewinding test * Test:Added the Sprint Length + Milestone merge test * Add:Implemented the future milestone * Add:Future milestone changes * Add:Future milestone changes * Chg: Voting on endBlockHash rather than rootHash * Chg: Changed the logic of future milestone from rootHash checking to endBlockHash checking * Fix:Using endBockHash while verifying the incoming milestone * Chg:Variable names for better readiblity * Fix:Testing changes * Add:metrics for milestone implementation * Add:Metrics for milestone implementatian * Fix:Order of statements in a function for better optimization * Chg:Removed unrequired file * Fix:new variable intialization * Add:Comment to increase readiblity * Fix:Logs * Chg:Name of GetVoteOnRootHash to GetVoteOnHash * Fix:Linting issues * Fixed linting issues * Rmv: Unnecessary logs and Add:Skip test for long tests * Fix:Checking current chain with whitelisted milestone or checkpoint in Finalized block function * Fix:Test * Fix:Whitelisting of Milestone and Checkpoint process * Fix: Milestone JSON structure * Chg:Testcases changes * Fix:Change from VoteOnRootHash to VoteOnHash * Fix:Variable name fix * Fix:Finalized API * internal/jsre/deps: update web3.js bundle * Fix:milestone verifier * Chg:Handling the long future chain import issue * Fix:Lint issues * Fix:TestLowDiffLongChain and TestPrunedImportSide tests, used hardcoded value 128 instead of DefaultTriesInMemory value * Chg:Testcode for producing metrics * Chg:Milestong polling value to 32 secs * Add:Testcases * Add:Implemented the check to fetch the milestoneId from heimdall before locking the fork * Added GRPC method for FetchMilestoneID * Fix:lint issue * Fix:lint issue * Skiped out the tests which were mainly used to produce the supporting data * remove vcs build when running snyk * Add:Improved the logs and comments * fix linters * Skipped some test as they are panic due to timeout issue in github * Chg:Variable name LockerSprintNumber to LockedMilestoneNumber for better readablity and clarity * Chg:Conflicting variable names in milestone test file * Chg:Conflicting function names in milestone test file * fix : minor fix in TestInsertingSpanSizeBlocks * Fix:Mocking issue in TestInsertingSpanSizeBlocks * Fix:GRPC Polyproto Version * eth/downloader: skip peer drop due to whitelisting err * eth, tests/bor: bug fixes and minor refactor * Add:Implemented the milestone related functions in the HeimdallApp * Fix:Lint Errors & Remove:Redundant Code * Fix:Testing Errors * Fix:Bor integeration tests * Fix:Test errors * update heimdall client mock files * remove unused arguments * remove redundant code * Chg:Changed the milestone polling intervals * Add: added block finality from whitelisted checkpoint * skip future chain validation * Add:confirmation check of 16 blocks over the end block while voting for the milestone in GetVoteHash() function * Chg:Included endBlockNum in UnlockMutex function * Add:Property based test for milestone * Fix:Opening the lock while processing future milestone * Add:Property based test for futureMilestone * Defined the value of TempTriesInMemory * Fixed the finalized api * Fixed lint issues * eth: add logs while fetching and rewinding * fix linters: use default returns instead of recursive calls * Fix:Milestone intergration test * Add:GetVoteHash fn in mock backend * tests/bor: fix mock span * tests/bor: remove t.Parallel() * use bor namespace in ethclient, fix mock function --------- Co-authored-by: Vaibhav Jindal <vaibhavjindal29@gmail.com> Co-authored-by: VaibhavJindal <74560896+VAIBHAVJINDAL3012@users.noreply.github.com> Co-authored-by: Manav Darji <manavdarji.india@gmail.com> Co-authored-by: Evgeny Danienko <6655321@bk.ru> Co-authored-by: Shivam Sharma <shivam691999@gmail.com> Co-authored-by: Anshal Shukla <shukla.anshal85@gmail.com>
954 lines
21 KiB
Go
954 lines
21 KiB
Go
// Copyright 2015 The go-ethereum Authors
|
|
// This file is part of the go-ethereum library.
|
|
//
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
// package web3ext contains geth specific web3.js extensions.
|
|
package web3ext
|
|
|
|
var Modules = map[string]string{
|
|
"admin": AdminJs,
|
|
"clique": CliqueJs,
|
|
"ethash": EthashJs,
|
|
"debug": DebugJs,
|
|
"eth": EthJs,
|
|
"miner": MinerJs,
|
|
"net": NetJs,
|
|
"personal": PersonalJs,
|
|
"rpc": RpcJs,
|
|
"txpool": TxpoolJs,
|
|
"les": LESJs,
|
|
"vflux": VfluxJs,
|
|
|
|
// Bor related apis
|
|
"bor": BorJs,
|
|
}
|
|
|
|
const CliqueJs = `
|
|
web3._extend({
|
|
property: 'clique',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'getSnapshot',
|
|
call: 'clique_getSnapshot',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getSnapshotAtHash',
|
|
call: 'clique_getSnapshotAtHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getSigners',
|
|
call: 'clique_getSigners',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getSignersAtHash',
|
|
call: 'clique_getSignersAtHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'propose',
|
|
call: 'clique_propose',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'discard',
|
|
call: 'clique_discard',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'status',
|
|
call: 'clique_status',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getSigner',
|
|
call: 'clique_getSigner',
|
|
params: 1,
|
|
inputFormatter: [null]
|
|
}),
|
|
],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'proposals',
|
|
getter: 'clique_proposals'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const EthashJs = `
|
|
web3._extend({
|
|
property: 'ethash',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'getWork',
|
|
call: 'ethash_getWork',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getHashrate',
|
|
call: 'ethash_getHashrate',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'submitWork',
|
|
call: 'ethash_submitWork',
|
|
params: 3,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'submitHashrate',
|
|
call: 'ethash_submitHashrate',
|
|
params: 2,
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const AdminJs = `
|
|
web3._extend({
|
|
property: 'admin',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'addPeer',
|
|
call: 'admin_addPeer',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'removePeer',
|
|
call: 'admin_removePeer',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'addTrustedPeer',
|
|
call: 'admin_addTrustedPeer',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'removeTrustedPeer',
|
|
call: 'admin_removeTrustedPeer',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'exportChain',
|
|
call: 'admin_exportChain',
|
|
params: 3,
|
|
inputFormatter: [null, null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'importChain',
|
|
call: 'admin_importChain',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'sleepBlocks',
|
|
call: 'admin_sleepBlocks',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'startHTTP',
|
|
call: 'admin_startHTTP',
|
|
params: 5,
|
|
inputFormatter: [null, null, null, null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stopHTTP',
|
|
call: 'admin_stopHTTP'
|
|
}),
|
|
// This method is deprecated.
|
|
new web3._extend.Method({
|
|
name: 'startRPC',
|
|
call: 'admin_startRPC',
|
|
params: 5,
|
|
inputFormatter: [null, null, null, null, null]
|
|
}),
|
|
// This method is deprecated.
|
|
new web3._extend.Method({
|
|
name: 'stopRPC',
|
|
call: 'admin_stopRPC'
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'startWS',
|
|
call: 'admin_startWS',
|
|
params: 4,
|
|
inputFormatter: [null, null, null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stopWS',
|
|
call: 'admin_stopWS'
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getMaxPeers',
|
|
call: 'admin_getMaxPeers'
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setMaxPeers',
|
|
call: 'admin_setMaxPeers',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getExecutionPoolSize',
|
|
call: 'admin_getExecutionPoolSize'
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getExecutionPoolRequestTimeout',
|
|
call: 'admin_getExecutionPoolRequestTimeout'
|
|
}),
|
|
// new web3._extend.Method({
|
|
// name: 'setWSExecutionPoolRequestTimeout',
|
|
// call: 'admin_setWSExecutionPoolRequestTimeout',
|
|
// params: 1
|
|
// }),
|
|
// new web3._extend.Method({
|
|
// name: 'setHttpExecutionPoolRequestTimeout',
|
|
// call: 'admin_setHttpExecutionPoolRequestTimeout',
|
|
// params: 1
|
|
// }),
|
|
new web3._extend.Method({
|
|
name: 'setWSExecutionPoolSize',
|
|
call: 'admin_setWSExecutionPoolSize',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setHttpExecutionPoolSize',
|
|
call: 'admin_setHttpExecutionPoolSize',
|
|
}),
|
|
],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'nodeInfo',
|
|
getter: 'admin_nodeInfo'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'peers',
|
|
getter: 'admin_peers'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'datadir',
|
|
getter: 'admin_datadir'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const DebugJs = `
|
|
web3._extend({
|
|
property: 'debug',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'accountRange',
|
|
call: 'debug_accountRange',
|
|
params: 6,
|
|
inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter, null, null, null, null, null],
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'printBlock',
|
|
call: 'debug_printBlock',
|
|
params: 1,
|
|
outputFormatter: console.log
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getRawHeader',
|
|
call: 'debug_getRawHeader',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getRawBlock',
|
|
call: 'debug_getRawBlock',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getRawReceipts',
|
|
call: 'debug_getRawReceipts',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getRawTransaction',
|
|
call: 'debug_getRawTransaction',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setHead',
|
|
call: 'debug_setHead',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'seedHash',
|
|
call: 'debug_seedHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'dumpBlock',
|
|
call: 'debug_dumpBlock',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'chaindbProperty',
|
|
call: 'debug_chaindbProperty',
|
|
params: 1,
|
|
outputFormatter: console.log
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'chaindbCompact',
|
|
call: 'debug_chaindbCompact',
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'verbosity',
|
|
call: 'debug_verbosity',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'vmodule',
|
|
call: 'debug_vmodule',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'backtraceAt',
|
|
call: 'debug_backtraceAt',
|
|
params: 1,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stacks',
|
|
call: 'debug_stacks',
|
|
params: 1,
|
|
inputFormatter: [null],
|
|
outputFormatter: console.log
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'freeOSMemory',
|
|
call: 'debug_freeOSMemory',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setGCPercent',
|
|
call: 'debug_setGCPercent',
|
|
params: 1,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'memStats',
|
|
call: 'debug_memStats',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'gcStats',
|
|
call: 'debug_gcStats',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'cpuProfile',
|
|
call: 'debug_cpuProfile',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'startCPUProfile',
|
|
call: 'debug_startCPUProfile',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stopCPUProfile',
|
|
call: 'debug_stopCPUProfile',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'goTrace',
|
|
call: 'debug_goTrace',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'startGoTrace',
|
|
call: 'debug_startGoTrace',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stopGoTrace',
|
|
call: 'debug_stopGoTrace',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'blockProfile',
|
|
call: 'debug_blockProfile',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setBlockProfileRate',
|
|
call: 'debug_setBlockProfileRate',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'writeBlockProfile',
|
|
call: 'debug_writeBlockProfile',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'mutexProfile',
|
|
call: 'debug_mutexProfile',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setMutexProfileFraction',
|
|
call: 'debug_setMutexProfileFraction',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'writeMutexProfile',
|
|
call: 'debug_writeMutexProfile',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'writeMemProfile',
|
|
call: 'debug_writeMemProfile',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceBlock',
|
|
call: 'debug_traceBlock',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceBlockFromFile',
|
|
call: 'debug_traceBlockFromFile',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceBadBlock',
|
|
call: 'debug_traceBadBlock',
|
|
params: 1,
|
|
inputFormatter: [null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'standardTraceBadBlockToFile',
|
|
call: 'debug_standardTraceBadBlockToFile',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'intermediateRoots',
|
|
call: 'debug_intermediateRoots',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'standardTraceBlockToFile',
|
|
call: 'debug_standardTraceBlockToFile',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceBlockByNumber',
|
|
call: 'debug_traceBlockByNumber',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceBlockByHash',
|
|
call: 'debug_traceBlockByHash',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceTransaction',
|
|
call: 'debug_traceTransaction',
|
|
params: 2,
|
|
inputFormatter: [null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'traceCall',
|
|
call: 'debug_traceCall',
|
|
params: 3,
|
|
inputFormatter: [null, null, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'preimage',
|
|
call: 'debug_preimage',
|
|
params: 1,
|
|
inputFormatter: [null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getBadBlocks',
|
|
call: 'debug_getBadBlocks',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'storageRangeAt',
|
|
call: 'debug_storageRangeAt',
|
|
params: 5,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getModifiedAccountsByNumber',
|
|
call: 'debug_getModifiedAccountsByNumber',
|
|
params: 2,
|
|
inputFormatter: [null, null],
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getModifiedAccountsByHash',
|
|
call: 'debug_getModifiedAccountsByHash',
|
|
params: 2,
|
|
inputFormatter:[null, null],
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'freezeClient',
|
|
call: 'debug_freezeClient',
|
|
params: 1,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getAccessibleState',
|
|
call: 'debug_getAccessibleState',
|
|
params: 2,
|
|
inputFormatter:[web3._extend.formatters.inputBlockNumberFormatter, web3._extend.formatters.inputBlockNumberFormatter],
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getWhitelistedCheckpoint',
|
|
call: 'debug_getWhitelistedCheckpoint',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'purgeWhitelistedCheckpoint',
|
|
call: 'debug_purgeWhitelistedCheckpoint',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getWhitelistedMilestone',
|
|
call: 'debug_getWhitelistedMilestone',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'purgeWhitelistedMilestone',
|
|
call: 'debug_purgeWhitelistedMilestone',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getTraceStack',
|
|
call: 'debug_getTraceStack',
|
|
params: 0,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'dbGet',
|
|
call: 'debug_dbGet',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'dbAncient',
|
|
call: 'debug_dbAncient',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'dbAncients',
|
|
call: 'debug_dbAncients',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setTrieFlushInterval',
|
|
call: 'debug_setTrieFlushInterval',
|
|
params: 1
|
|
}),
|
|
],
|
|
properties: []
|
|
});
|
|
`
|
|
|
|
const EthJs = `
|
|
web3._extend({
|
|
property: 'eth',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'getTransactionReceiptsByBlock',
|
|
call: 'eth_getTransactionReceiptsByBlock',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'chainId',
|
|
call: 'eth_chainId',
|
|
params: 0
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'sign',
|
|
call: 'eth_sign',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'resend',
|
|
call: 'eth_resend',
|
|
params: 3,
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'signTransaction',
|
|
call: 'eth_signTransaction',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'estimateGas',
|
|
call: 'eth_estimateGas',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputBlockNumberFormatter],
|
|
outputFormatter: web3._extend.utils.toDecimal
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'submitTransaction',
|
|
call: 'eth_submitTransaction',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'fillTransaction',
|
|
call: 'eth_fillTransaction',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getHeaderByNumber',
|
|
call: 'eth_getHeaderByNumber',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getHeaderByHash',
|
|
call: 'eth_getHeaderByHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getBlockByNumber',
|
|
call: 'eth_getBlockByNumber',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, function (val) { return !!val; }]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getBlockByHash',
|
|
call: 'eth_getBlockByHash',
|
|
params: 2,
|
|
inputFormatter: [null, function (val) { return !!val; }]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getRawTransaction',
|
|
call: 'eth_getRawTransactionByHash',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getRawTransactionFromBlock',
|
|
call: function(args) {
|
|
return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex';
|
|
},
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getProof',
|
|
call: 'eth_getProof',
|
|
params: 3,
|
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputBlockNumberFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'createAccessList',
|
|
call: 'eth_createAccessList',
|
|
params: 2,
|
|
inputFormatter: [null, web3._extend.formatters.inputBlockNumberFormatter],
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'feeHistory',
|
|
call: 'eth_feeHistory',
|
|
params: 3,
|
|
inputFormatter: [null, web3._extend.formatters.inputBlockNumberFormatter, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getLogs',
|
|
call: 'eth_getLogs',
|
|
params: 1,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'call',
|
|
call: 'eth_call',
|
|
params: 3,
|
|
inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputDefaultBlockNumberFormatter, null],
|
|
}),
|
|
],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'pendingTransactions',
|
|
getter: 'eth_pendingTransactions',
|
|
outputFormatter: function(txs) {
|
|
var formatted = [];
|
|
for (var i = 0; i < txs.length; i++) {
|
|
formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
|
|
formatted[i].blockHash = null;
|
|
}
|
|
return formatted;
|
|
}
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'maxPriorityFeePerGas',
|
|
getter: 'eth_maxPriorityFeePerGas',
|
|
outputFormatter: web3._extend.utils.toBigNumber
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const MinerJs = `
|
|
web3._extend({
|
|
property: 'miner',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'start',
|
|
call: 'miner_start',
|
|
params: 1,
|
|
inputFormatter: [null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'stop',
|
|
call: 'miner_stop'
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setEtherbase',
|
|
call: 'miner_setEtherbase',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setExtra',
|
|
call: 'miner_setExtra',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setGasPrice',
|
|
call: 'miner_setGasPrice',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.utils.fromDecimal]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setGasLimit',
|
|
call: 'miner_setGasLimit',
|
|
params: 1,
|
|
inputFormatter: [web3._extend.utils.fromDecimal]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setRecommitInterval',
|
|
call: 'miner_setRecommitInterval',
|
|
params: 1,
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'getHashrate',
|
|
call: 'miner_getHashrate'
|
|
}),
|
|
],
|
|
properties: []
|
|
});
|
|
`
|
|
|
|
const NetJs = `
|
|
web3._extend({
|
|
property: 'net',
|
|
methods: [],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'version',
|
|
getter: 'net_version'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const PersonalJs = `
|
|
web3._extend({
|
|
property: 'personal',
|
|
methods: [
|
|
new web3._extend.Method({
|
|
name: 'importRawKey',
|
|
call: 'personal_importRawKey',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'sign',
|
|
call: 'personal_sign',
|
|
params: 3,
|
|
inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'ecRecover',
|
|
call: 'personal_ecRecover',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'openWallet',
|
|
call: 'personal_openWallet',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'deriveAccount',
|
|
call: 'personal_deriveAccount',
|
|
params: 3
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'signTransaction',
|
|
call: 'personal_signTransaction',
|
|
params: 2,
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'unpair',
|
|
call: 'personal_unpair',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'initializeWallet',
|
|
call: 'personal_initializeWallet',
|
|
params: 1
|
|
})
|
|
],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'listWallets',
|
|
getter: 'personal_listWallets'
|
|
}),
|
|
]
|
|
})
|
|
`
|
|
|
|
const RpcJs = `
|
|
web3._extend({
|
|
property: 'rpc',
|
|
methods: [],
|
|
properties: [
|
|
new web3._extend.Property({
|
|
name: 'modules',
|
|
getter: 'rpc_modules'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const TxpoolJs = `
|
|
web3._extend({
|
|
property: 'txpool',
|
|
methods: [],
|
|
properties:
|
|
[
|
|
new web3._extend.Property({
|
|
name: 'content',
|
|
getter: 'txpool_content'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'inspect',
|
|
getter: 'txpool_inspect'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'status',
|
|
getter: 'txpool_status',
|
|
outputFormatter: function(status) {
|
|
status.pending = web3._extend.utils.toDecimal(status.pending);
|
|
status.queued = web3._extend.utils.toDecimal(status.queued);
|
|
return status;
|
|
}
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'contentFrom',
|
|
call: 'txpool_contentFrom',
|
|
params: 1,
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const LESJs = `
|
|
web3._extend({
|
|
property: 'les',
|
|
methods:
|
|
[
|
|
new web3._extend.Method({
|
|
name: 'getCheckpoint',
|
|
call: 'les_getCheckpoint',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'clientInfo',
|
|
call: 'les_clientInfo',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'priorityClientInfo',
|
|
call: 'les_priorityClientInfo',
|
|
params: 3
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setClientParams',
|
|
call: 'les_setClientParams',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'setDefaultParams',
|
|
call: 'les_setDefaultParams',
|
|
params: 1
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'addBalance',
|
|
call: 'les_addBalance',
|
|
params: 2
|
|
}),
|
|
],
|
|
properties:
|
|
[
|
|
new web3._extend.Property({
|
|
name: 'latestCheckpoint',
|
|
getter: 'les_latestCheckpoint'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'checkpointContractAddress',
|
|
getter: 'les_getCheckpointContractAddress'
|
|
}),
|
|
new web3._extend.Property({
|
|
name: 'serverInfo',
|
|
getter: 'les_serverInfo'
|
|
}),
|
|
]
|
|
});
|
|
`
|
|
|
|
const VfluxJs = `
|
|
web3._extend({
|
|
property: 'vflux',
|
|
methods:
|
|
[
|
|
new web3._extend.Method({
|
|
name: 'distribution',
|
|
call: 'vflux_distribution',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'timeout',
|
|
call: 'vflux_timeout',
|
|
params: 2
|
|
}),
|
|
new web3._extend.Method({
|
|
name: 'value',
|
|
call: 'vflux_value',
|
|
params: 2
|
|
}),
|
|
],
|
|
properties:
|
|
[
|
|
new web3._extend.Property({
|
|
name: 'requestStats',
|
|
getter: 'vflux_requestStats'
|
|
}),
|
|
]
|
|
});
|
|
`
|