Skip to content

Refactor to allow for single sponsorWallet updates #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6c7985d
Refactor to allow for single sponsorWallet updates that enables deplo…
acenolaza May 2, 2024
aee6a86
Adds support to self-funded walletDerivationScheme type to local-test…
acenolaza May 3, 2024
96937b5
Uses both sponsorWalletAddress and dataFeedId as keys on the pendingT…
acenolaza May 3, 2024
947bdab
Fixes tests
acenolaza May 6, 2024
780250d
Renames walletDerivationScheme type option from fallback to fixed
acenolaza May 6, 2024
48b42f7
Improves walletDerivationSchemeSchema validation
acenolaza May 6, 2024
20aa6f8
Sorts PendingTransactionInfo objects by consecutivelyUpdatableCount b…
acenolaza May 6, 2024
9c86b64
Linting
acenolaza May 6, 2024
2222231
Test for fixed walletDerivationScheme.type on utils.ts
acenolaza May 6, 2024
35aa3a6
Adds test for fixed wallet derivation type to submit-transactions.tes…
acenolaza May 7, 2024
d5215d0
Revert to use address property on ethers.Wallet objects instead of us…
acenolaza May 8, 2024
0a3b3cc
Updates README on fixed walletDerivationScheme type
acenolaza May 8, 2024
9f656ee
walletDerivationSchemeSchema discrimitantedUnion refactor
acenolaza May 9, 2024
d958d2f
Removes .reduce(...) call to fiter out null or undefined PendingTrans…
acenolaza May 9, 2024
bea2afb
Renames test in gas-price.test
acenolaza May 9, 2024
427c832
Removes inline comment and renames variable in gas-price.ts
acenolaza May 9, 2024
2046954
Fixes typo
acenolaza May 9, 2024
ad7ac3a
Refactor sponsor wallet derivation and private key caching mapping
acenolaza May 10, 2024
f1ddddb
Merge remote-tracking branch 'origin/main' into single-sponsor-wallet
acenolaza May 10, 2024
54c2b91
Lint
acenolaza May 10, 2024
40093f5
Adds back .send to contracts function calls
acenolaza May 10, 2024
f0bd142
Removes else statement in submit-transactions.ts"
acenolaza May 10, 2024
03bde8e
Adds comment to pendingTransactionsInfo state object
acenolaza May 13, 2024
3ce687b
Fixes drawio pipeline
acenolaza May 13, 2024
1fc9385
Change .reduce() with 2 .map() on submitBatchTransaction
acenolaza May 13, 2024
de64763
Make submitBatchTransaction() call submitUpdate()
acenolaza May 14, 2024
eec9d7b
Handles transaction errors inside submitUpdate()
acenolaza May 14, 2024
53214da
Refactor wallet derivation types
acenolaza May 14, 2024
d19a02a
Minor refactor
acenolaza May 14, 2024
e2bc900
Merge remote-tracking branch 'origin/main' into single-sponsor-wallet
acenolaza May 15, 2024
8e876ab
Merge remote-tracking branch 'origin/main' into single-sponsor-wallet
acenolaza May 15, 2024
ee61e56
Prettier
acenolaza May 15, 2024
7303ecd
Fixes e2e
acenolaza May 15, 2024
c4d54e8
Updates airseeker.example.json i local-test-configuration dir
acenolaza May 15, 2024
d17db3c
Removes the sort desc by consecutiveUpdatableCount
acenolaza May 15, 2024
49d3db6
Refactor submitTransactions to return the success count
acenolaza May 16, 2024
9b62a07
Merge remote-tracking branch 'origin/main' into single-sponsor-wallet
acenolaza May 16, 2024
960fca3
Update README on self-funded wallet derivation type
acenolaza May 16, 2024
2254e1e
Refactor pendingTransactionsInfo object updater
acenolaza May 16, 2024
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
6 changes: 2 additions & 4 deletions local-test-configuration/airnode-feed-1/airnode-feed.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
"triggers": {
"signedApiUpdates": [
{
"signedApiName": "localhost",
"templateIds": [
"0xa5419706d8edb3bbafad83fe2b4e7dc851de5e4cd9529f9f27bb393016c81ae5",
"0x8f255387c5fdb03117d82372b8fa5c7813881fd9a8202b7cc373f1a5868496b2",
"0x89bbdb4e2d7510abf1ca0ed53295e31c00a6939fc12e77d67bf3a4cb3c31f61c"
],
"fetchInterval": 10,
"updateDelay": 0
"fetchInterval": 10
}
]
},
Expand Down Expand Up @@ -94,7 +92,7 @@
}
],
"nodeSettings": {
"nodeVersion": "0.4.0",
"nodeVersion": "1.0.0",
"airnodeWalletMnemonic": "${AIRNODE_WALLET_MNEMONIC}",
"stage": "local-example"
}
Expand Down
6 changes: 2 additions & 4 deletions local-test-configuration/airnode-feed-2/airnode-feed.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
"triggers": {
"signedApiUpdates": [
{
"signedApiName": "localhost",
"templateIds": [
"0xa5419706d8edb3bbafad83fe2b4e7dc851de5e4cd9529f9f27bb393016c81ae5",
"0x8f255387c5fdb03117d82372b8fa5c7813881fd9a8202b7cc373f1a5868496b2",
"0x89bbdb4e2d7510abf1ca0ed53295e31c00a6939fc12e77d67bf3a4cb3c31f61c"
],
"fetchInterval": 20,
"updateDelay": 60
"fetchInterval": 20
}
]
},
Expand Down Expand Up @@ -94,7 +92,7 @@
}
],
"nodeSettings": {
"nodeVersion": "0.4.0",
"nodeVersion": "1.0.0",
"airnodeWalletMnemonic": "${AIRNODE_WALLET_MNEMONIC}",
"stage": "local-example"
}
Expand Down
26 changes: 20 additions & 6 deletions local-test-configuration/monitoring/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,13 @@ <h2>Active data feeds</h2>
const rpcUrl = urlParams.get('rpcUrl'),
airseekerRegistryAddress = urlParams.get('airseekerRegistryAddress'),
airseekerMnemonic = decodeURIComponent(urlParams.get('airseekerMnemonic')),
walletDerivationScheme = decodeURIComponent(urlParams.get('walletDerivationScheme'));
walletDerivationScheme = decodeURIComponent(urlParams.get('walletDerivationScheme')),
sponsorAddress = decodeURIComponent(urlParams.get('sponsorAddress'));

if (!airseekerRegistryAddress) throw new Error('airseekerRegistryAddress must be provided as URL parameter');
if (!airseekerMnemonic) throw new Error('airseekerMnemonic must be provided as URL parameter');
if (walletDerivationScheme === 'fallback' && !sponsorAddress)
throw new Error('sponsorAddress must be provided as URL parameter when walletDerivationScheme is "fallback"');

// See: https://github.com/GoogleChromeLabs/jsbi/issues/30#issuecomment-953187833
BigInt.prototype.toJSON = function () {
Expand Down Expand Up @@ -876,10 +879,18 @@ <h2>Active data feeds</h2>
//
// For self-funded feeds it's more suitable to derive the hash also from update parameters. This does not apply to
// mananaged feeds which want to be funded by the same wallet independently of the update parameters.
const sponsorAddressHash =
walletDerivationScheme === 'self-funded'
? deriveSponsorAddressHashForSelfFundedFeed(dapiNameOrDataFeedId, updateParameters)
: deriveSponsorAddressHashForManagedFeed(dapiNameOrDataFeedId);
let sponsorAddressHash;
switch (walletDerivationScheme.type) {
case 'self-funded':
sponsorAddressHash = deriveSponsorAddressHashForSelfFundedFeed(dapiNameOrDataFeedId, updateParameters);
break;
case 'managed':
sponsorAddressHash = deriveSponsorAddressHashForManagedFeed(dapiNameOrDataFeedId);
break;
case 'fallback':
sponsorAddressHash = walletDerivationScheme.sponsorAddress;
break;
}

return deriveSponsorWalletFromSponsorAddressHash(sponsorWalletMnemonic, sponsorAddressHash);
};
Expand Down Expand Up @@ -938,7 +949,10 @@ <h2>Active data feeds</h2>
airseekerMnemonic,
dapiName ?? dataFeed.dataFeedId,
updateParameters,
walletDerivationScheme
{
type: walletDerivationScheme,
...(sponsorAddress && { sponsorAddress }),
}
);
const dataFeedInfo = {
dapiName: dapiName,
Expand Down
Loading
Loading