Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
92fd32b
chore: refactor V1 contracts
guidiaz Nov 8, 2022
b84d2a1
chore: fmt!
guidiaz Nov 8, 2022
6969838
test: fix Destructible tests
guidiaz Nov 8, 2022
3d32780
chore: bump package version to 2.0.0
guidiaz Nov 9, 2022
e162b24
feat: first approach to libs/WitnetV2.sol
guidiaz Nov 9, 2022
f6bf459
feat: first approach to interfaces/V2
guidiaz Nov 9, 2022
9a5f930
chore: ammedments to common WitnetUpgradableBase
guidiaz Nov 9, 2022
5a4fa00
feat: first approach to WRBv2
guidiaz Nov 9, 2022
f1cc5cb
feat: first approach to evm-interactive SoFIR
guidiaz Nov 9, 2022
9c19dfa
feat(libs): refactor and add generic support to arrays
guidiaz Nov 25, 2022
954c4d0
chore(v2): keep polishing interfaces and data structs
guidiaz Nov 25, 2022
6310bc4
feat(libs): add encoding methods
guidiaz Nov 25, 2022
345a997
feat(libs): implement wildcard replacements in string values
guidiaz Nov 25, 2022
e46cf77
chore(libs): adapt existing tests to latest changes
guidiaz Nov 25, 2022
6ec34e7
feat: first implementation approach to WitnetBytecodes
guidiaz Nov 25, 2022
479ab92
test(libs): add tests for WitnetBuffer.replace
guidiaz Dec 1, 2022
44ead2d
test(libs): add tests for WitnetBuffer.concat
guidiaz Dec 1, 2022
89e1cb7
test(libs): add test for WitnetBuffer.mutate
guidiaz Dec 1, 2022
a11e68f
test(libs): add test for WitnetBuffer.fork
guidiaz Dec 1, 2022
8ff50d0
fix(lib): fix and optimize gas consumptions in WitnetBuffer
guidiaz Dec 1, 2022
3e0b768
test(libs): add test for WitnetLib.rplaceCborStringsFromBytes
guidiaz Dec 1, 2022
547f0dc
fix(libs): fix, refactor and and optimize WitnetLib.replaceCborString…
guidiaz Dec 1, 2022
5e0038a
chore(libs): fix solhint warnings
guidiaz Dec 1, 2022
d9342c7
fix(test): refactor test/helpers/UsingTestHelper.sol
guidiaz Dec 1, 2022
ef418d1
chore: rebasing from feat/v2 branch
guidiaz Dec 7, 2022
5114788
refactor(libs): no undescored vars in libs
guidiaz Dec 7, 2022
4262fe8
fix(libs): test, refine, refactor WitnetCBOR
guidiaz Dec 7, 2022
ab6cd8b
feat(libs): move encoding methods to new deployable lib
guidiaz Dec 7, 2022
3ccc82c
refactor(libs): no underscored vars in libs
guidiaz Dec 7, 2022
0b93560
test(libs): add unitary tests for WitnetEncodingLib
guidiaz Dec 7, 2022
94673db
test(migrations): avoid deploying whole stack when running tests
guidiaz Dec 7, 2022
652b13c
feat(bytecodes): polish and refactor to latest libs
guidiaz Dec 7, 2022
6b8a062
chore: add missing dev dependencies
guidiaz Dec 7, 2022
d8cdba7
test(bytecodes): add WitnetBytecodes unitary tests
guidiaz Dec 19, 2022
45b1661
fix(libs): as to pass WitnetBytecodes tests
guidiaz Dec 19, 2022
b1e2057
fix(bytecodes): as to pass WitnetBytecodes tests
guidiaz Dec 19, 2022
bd8293c
feat(bytecodes): hashWeightRewardOf(b32, b32)
guidiaz Dec 19, 2022
008f3b3
chore(libs): adapt tests to latest changes
guidiaz Dec 19, 2022
5d9824f
chore: rename migration scripts
guidiaz Dec 28, 2022
79e5018
chore: add migration script for WitnetBytecodes, proxy and encoding lib
guidiaz Dec 28, 2022
106f03f
feat: deploy WitnetBytecodes on polygon.goerli
guidiaz Dec 28, 2022
c2688cd
feat: implement lookupDataSourceResultDataType(hash)
guidiaz Dec 28, 2022
afacaca
feat(requests): implement WitnetRequestTemplate based on WitnetBytecodes
guidiaz Dec 28, 2022
da53838
fix(libs): disable formal validation of data source url parts
guidiaz Dec 29, 2022
4f8d9f9
feat(bytecodes): revert if looking up for unknown data source
guidiaz Dec 29, 2022
cd4f681
chore(requests): polish WitnetRequestTemplate
guidiaz Dec 29, 2022
410c672
fix(libs): verifyRadonRequestResultDataType
guidiaz Dec 29, 2022
0f0d8dc
chore(request): keep polishing bytecodes template contract
guidiaz Dec 29, 2022
f8c8952
refactor(patterns): harmonize Upgradable and Clonable
guidiaz Jan 3, 2023
5f876f8
feat: let tally and result size be set on WitnetRequestTemplate const…
guidiaz Jan 3, 2023
5dc956a
chore: adopt OpenZeppelin's Initializable pattern
guidiaz Jan 3, 2023
d7855f5
refactor(patterns): rename Upgradable to Upgradeable
guidiaz Jan 3, 2023
7fa0dc5
chore: fmt!
guidiaz Jan 10, 2023
7ab169c
fix: test helper contracts
guidiaz Jan 10, 2023
c01a1bb
chore: bump package version to 0.6.3
guidiaz Jan 10, 2023
0e243de
refactor: remove WitnetProxy.proxy(): just not yet
guidiaz Jan 26, 2023
d6802ca
feat: further abstraction of Clonable pattern
guidiaz Jan 26, 2023
0cabbd6
feat(requests): verify aggregator and tally exist upon deployment of …
guidiaz Jan 26, 2023
bfa5ce9
fix(bytecodes): looking up for unkown sources, radon reducers or slas…
guidiaz Jan 26, 2023
0ef539b
chore(libs): avoid WitnetRequestTemplates having to link WitnetLib
guidiaz Jan 26, 2023
dffe45b
feat(requests): let WitnetRequestTemplate return last valid result, d…
guidiaz Jan 26, 2023
b65b93b
fix(proxy): allow transfers as to enable usingwitnet contracts to be …
guidiaz Jan 26, 2023
9f625bf
chore: re-deploy WitnetBytecodes proxy and impl in polygon goerli
guidiaz Jan 31, 2023
875afdd
refactor(bytecodes): simplify events
guidiaz Feb 16, 2023
4c3b624
feat(bytecodes): optimize unique hash verification on sources and red…
guidiaz Feb 16, 2023
ac820ac
refactor(bytecodes): retrievalHash => radHash
guidiaz Feb 16, 2023
b586790
refactor(bytecodes): fqdn => authority
guidiaz Feb 16, 2023
ecaf75f
test(bytecodes): adapt to latest refactorings
guidiaz Feb 16, 2023
ba45d35
feat: enable proxiable implementations to be clonable as well
guidiaz Feb 16, 2023
b5b98ae
refactor(libs): eventually encode resultDataMaxSize occupying timeloc…
guidiaz Feb 17, 2023
05923b2
fix(libs): exclude header tag and body length when encoding rad bytes
guidiaz Feb 17, 2023
2211bef
fix(bytecodes): append rad's header tag and body length on bytecodeOf…
guidiaz Feb 17, 2023
9c676c1
chore: move request template implementation to another branch
guidiaz Feb 17, 2023
799d0c3
refactor(bytecodes): remove data source's result min/max range by now
guidiaz Feb 17, 2023
3a62a31
feat(bytecodes): add argsCount field to data sources
guidiaz Feb 17, 2023
f4a9382
fix(libs): allow data source's schema to be empty
guidiaz Feb 17, 2023
443d6fa
feat(bytecodes): implement lookupDataSourceArgsCount
guidiaz Feb 17, 2023
cb717e1
fix(bytecodes): avoid randomness rads w/ same reducers be stored more…
guidiaz Feb 17, 2023
83d0070
feat(bytecodes): check args count for every source upon rad verification
guidiaz Feb 17, 2023
bca6569
refactor: force no receive() on WitnetUpgradableBase
guidiaz Feb 16, 2023
2bf5b07
feat: abstract feeder login from WitnetRequestTemplate
guidiaz Feb 16, 2023
46631e0
refactor: WitnetRequest abstract contract
guidiaz Feb 16, 2023
4961e70
feat: implement WitnetRequestFactory as Upgradeable and Clonable
guidiaz Feb 16, 2023
1b6536a
chore: add migration scripts for WitnetRequestFactory
guidiaz Feb 16, 2023
16cf17c
chore: bump package version to 0.6.4
guidiaz Feb 16, 2023
6bbb6d4
chore: deploy WitnetRequestFactory v0.6.4 on polygon goerli
guidiaz Feb 16, 2023
2d7d8f0
chore: deploy WitnetBytecodes WitnetRequestFactory on moonbase
guidiaz Feb 16, 2023
45bcdc6
chore(factory): re-arrange interfaces
guidiaz Feb 17, 2023
8fea398
feat(factory): support whether data sources require parameters or not
guidiaz Feb 17, 2023
d318e0e
feat(factory): let unproxified factory be used as such
guidiaz Feb 17, 2023
5ecaca2
refactor(requests): let WitnetRequest.modifySLA(sla) return IWitnetRe…
guidiaz Feb 17, 2023
e358cd8
chore: full upgrade of bytecodes and request factory on polygon goerli
guidiaz Feb 17, 2023
c7ec1ff
refactor(libs): RadonSLA param names
guidiaz Feb 17, 2023
5cd1063
fix(factory): use _clone instead of _cloneDeterministic for now
guidiaz Feb 17, 2023
30c0ec0
refactor(libs): turn all RadonSLA fields into uint
guidiaz Feb 18, 2023
f9616db
chore: drop alphas
guidiaz Feb 18, 2023
4b99ef5
refactor(bytecodes): RadonRetrieval => RadonRequest
guidiaz Feb 18, 2023
7e9f4da
feat(factory): repetead templates or requests return same address
guidiaz Feb 19, 2023
b818914
chore: upgrade to WB v0.6.4 on polygon goerli
guidiaz Feb 19, 2023
37f3197
feat: add curatorship to WitnetRequest instances
guidiaz Feb 20, 2023
b0dcfcf
fix(factory): avoid address collision from templates w/ different ver…
guidiaz Feb 20, 2023
4304df1
fix(bytecodes): avoid publishing templated authorities as data providers
guidiaz Feb 20, 2023
f5e5571
fix(factory): supportsInterface on unproxified factories
guidiaz Feb 20, 2023
971b200
chore: upgrade WB on polygon mumbai
guidiaz Feb 20, 2023
6a3ec41
chore: redeploy WRF on polygon mumbai
guidiaz Feb 20, 2023
d367726
fix(factory): _salt on clone
guidiaz Feb 20, 2023
2baaca8
fix(factory): emit event on settleArgs even though no new request is …
guidiaz Feb 20, 2023
ae1ec83
fix(factory): avoid regenerating bytecode on modifySLA if there's no …
guidiaz Feb 20, 2023
a0bbeb6
chore: bump package version to 0.6.5
guidiaz Feb 20, 2023
9b67b4d
chore: upgrade WRF to v0.6.5 on polygon mumbai
guidiaz Feb 20, 2023
43c2774
fix(libs): buf in WitnetBuffer.replace when wildcard on first positio…
guidiaz Feb 21, 2023
b2a3b40
chore: upgrade WB+lib on polygon mumbai
guidiaz Feb 21, 2023
3abe7c8
refactor(test): to latest changes
guidiaz Mar 1, 2023
f129d1b
chore: fmt!
guidiaz Mar 1, 2023
71e5c51
chore: deprecate node 14.x in github actions
guidiaz Mar 1, 2023
2295a0b
chore: refactor flattening scripts
guidiaz Mar 3, 2023
5ec84be
chore: upgrade WSB to v0.6.5 on Moonbase
guidiaz Mar 3, 2023
5c13979
chore: upgrade WSB to v0.6.5 on Ethereum Mainnet
guidiaz Mar 3, 2023
b53ec98
feat(factory): fork request if no curator tries to modify SLA
guidiaz Mar 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"import/export": 0,
"no-useless-constructor": 1,
"handle-callback-err": 1,
"max-len" : ["error", { "code": 120 }]
"max-len" : ["error", { "code": 130 }]
}
}
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v1
Expand Down
1 change: 1 addition & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"modifier-name-mixedcase": "warn",
"no-empty-blocks": "off",
"no-inline-assembly": "off",
"var-name-mixedcase": "off",
"reason-string": [
"warn",
{
Expand Down
57 changes: 32 additions & 25 deletions README.md

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions contracts/WitnetRequestBoard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@ abstract contract WitnetRequestBoard is
IWitnetRequestBoardRequestor,
IWitnetRequestBoardView,
IWitnetRequestParser
{
receive() external payable {
revert("WitnetRequestBoard: no transfers accepted");
}
}
{}
60 changes: 38 additions & 22 deletions contracts/apps/WitnetRandomness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,18 @@ contract WitnetRandomness


// ================================================================================================================
// --- 'Clonable' overriden functions -----------------------------------------------------------------------------
// --- 'Clonable' extension ---------------------------------------------------------------------------------------

/// Deploys and returns the address of a minimal proxy clone that replicates contract
/// behaviour while using its own EVM storage.
/// @dev This function should always provide a new address, no matter how many times
/// @dev is actually called from the same `msg.sender`.
function clone()
public
virtual override
returns (Clonable _newInstance)
virtual public
wasInitialized
returns (WitnetRandomness)
{
_newInstance = super.clone();
_clone(_newInstance);
return _afterClone(_clone());
}

/// Deploys and returns the address of a minimal proxy clone that replicates contract
Expand All @@ -270,24 +269,37 @@ contract WitnetRandomness
/// @dev the clone. Using the same `_salt` multiple time will revert, since
/// @dev no contract can be deployed more than once at the same address.
function cloneDeterministic(bytes32 _salt)
public
virtual override
returns (Clonable _newInstance)
virtual public
wasInitialized
returns (WitnetRandomness)
{
_newInstance = super.cloneDeterministic(_salt);
_clone(_newInstance);
return _afterClone(_cloneDeterministic(_salt));
}

/// @notice Initializes a cloned instance.
/// @dev Every cloned instance can only get initialized once.
function initializeClone(bytes memory _initData)
virtual external
initializer // => ensure a cloned instance can only be initialized once
onlyDelegateCalls // => this method can only be called upon cloned instances
{
_initialize(_initData);
}

// ================================================================================================================
// --- 'Initializable' overriden functions ------------------------------------------------------------------------
/// @notice Tells whether this instance has been initialized.
function initialized()
override
public view
returns (bool)
{
return address(witnetRandomnessRequest) != address(0);
}

/// @dev Initializes contract's storage context.
function initialize(bytes memory _initData)
public
virtual override
/// @notice Re-initialize contract's storage context upon a new upgrade from a proxy.
/// @dev Must fail when trying to upgrade to same logic contract more than once.
function _initialize(bytes memory _initData)
virtual internal
{
require(address(witnetRandomnessRequest) == address(0), "WitnetRandomness: already initialized");
witnetRandomnessRequest = WitnetRequestRandomness(
abi.decode(
_initData,
Expand All @@ -301,10 +313,14 @@ contract WitnetRandomness
// --- INTERNAL FUNCTIONS -----------------------------------------------------------------------------------------

/// @dev Common steps for both deterministic and non-deterministic cloning.
function _clone(Clonable _instance) internal {
address _request = address(witnetRandomnessRequest.clone());
Ownable(_request).transferOwnership(msg.sender);
_instance.initialize(abi.encode(_request));
function _afterClone(address _instance)
virtual internal
returns (WitnetRandomness)
{
address _randomnessRequest = address(witnetRandomnessRequest.clone());
Ownable(_randomnessRequest).transferOwnership(msg.sender);
WitnetRandomness(_instance).initializeClone(abi.encode(_randomnessRequest));
return WitnetRandomness(_instance);
}

/// @dev Returns index of the Most Significant Bit of the given number, applying De Bruijn O(1) algorithm.
Expand Down
Loading