Skip to content
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

feat: add script and task for migration #208

Merged
merged 67 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
e420562
add script and task for migration
0xCardinalError Oct 11, 2023
0339c93
add task and hre for ethers
0xCardinalError Oct 12, 2023
b95b2cd
update info on migration
0xCardinalError Oct 12, 2023
ede46cd
Merge branch 'master' of https://github.com/ethersphere/storage-incen…
0xCardinalError Oct 24, 2023
89a4480
do it on main fork
0xCardinalError Oct 24, 2023
0f679c2
add migration to root, add it to task, working copy of migration
0xCardinalError Oct 24, 2023
f9000a3
add tyep check
0xCardinalError Oct 24, 2023
972f675
remove erc20 transfers
0xCardinalError Oct 24, 2023
a4e1a4d
remove tests for ERC20 as we will not be transfering it
0xCardinalError Oct 26, 2023
4b4df09
Merge branch 'master' of https://github.com/ethersphere/storage-incen…
0xCardinalError Oct 31, 2023
b34717b
install tenderly hh plugin for verifications
0xCardinalError Oct 31, 2023
17c43a5
add tenderly config and init data
0xCardinalError Oct 31, 2023
362bdde
add tenderly configs
0xCardinalError Oct 31, 2023
68ce454
final config for mainfork and tenderly
0xCardinalError Nov 2, 2023
4ba73da
move migrations to folder
0xCardinalError Nov 2, 2023
1452c6d
fix stamp scripts, remove tenderly as it breaks tests
0xCardinalError Nov 2, 2023
d8784a6
remove flat
0xCardinalError Nov 3, 2023
e2e5ec2
remove tenderly as it breaks tests
0xCardinalError Nov 3, 2023
4c1abb0
add steps
0xCardinalError Nov 6, 2023
e650ddb
refine steps
0xCardinalError Nov 6, 2023
a1b1257
add current command
0xCardinalError Nov 6, 2023
b360ddb
change end
0xCardinalError Nov 6, 2023
c8f88fc
block info
0xCardinalError Nov 6, 2023
872c670
add snapshot from current state
0xCardinalError Nov 6, 2023
40e2923
add stamp var
0xCardinalError Nov 7, 2023
821173d
Replace mainfork with tenderly as in that case verifications will work
0xCardinalError Nov 7, 2023
6b1ef6f
disable verification
0xCardinalError Nov 7, 2023
097f3fe
add batch script
0xCardinalError Nov 8, 2023
c3b446a
working bulk migration script
0xCardinalError Nov 8, 2023
d05f6f7
latest migration test
0xCardinalError Nov 8, 2023
31cb676
add comments and info
0xCardinalError Nov 8, 2023
504b34e
add some automations for tenderly fork deployments
0xCardinalError Nov 8, 2023
982a218
refactor tenderly with mainnet
0xCardinalError Nov 9, 2023
e5ef1eb
modify tenderly parts for proper workflow
0xCardinalError Nov 9, 2023
789ee96
make oracle unpaused by default
0xCardinalError Nov 9, 2023
79bf910
tags
0xCardinalError Nov 9, 2023
35b7f11
cleanup messages, try again with non signer to set roles
0xCardinalError Nov 10, 2023
6d3f92b
remove simulation as it breaks deployment
0xCardinalError Nov 11, 2023
16eddd1
cleanup tenderly
0xCardinalError Nov 11, 2023
7f66d06
proper order for reset script
0xCardinalError Nov 12, 2023
7f970e9
comment out tenderly as it breaks tests
0xCardinalError Nov 12, 2023
b5d868e
fix lint
0xCardinalError Nov 13, 2023
b80d42e
reset fix for TS
0xCardinalError Nov 13, 2023
250f212
add pause so test doesnt fail
0xCardinalError Nov 17, 2023
e02b4c1
Merge branch 'master' of github.com:ethersphere/storage-incentives in…
0xCardinalError Nov 20, 2023
540aebb
add all the changes per review
0xCardinalError Nov 20, 2023
0397b16
fix type assertion
0xCardinalError Nov 22, 2023
f8ffa3a
cleanup more
0xCardinalError Nov 22, 2023
172b45c
migration of goerlis stamps
0xCardinalError Nov 27, 2023
930d1cc
add fail event for batch loop so we get info but continue looping
0xCardinalError Nov 27, 2023
0c22ae4
change const
0xCardinalError Nov 28, 2023
aa47989
unionize migration scripts
0xCardinalError Nov 28, 2023
68f3904
use id
0xCardinalError Nov 28, 2023
63b9985
change event name
0xCardinalError Nov 28, 2023
8a7305c
Set 70 as sweet spot, add buffer for gas limit
0xCardinalError Nov 28, 2023
e12092e
add buffer for single batch
0xCardinalError Nov 28, 2023
b003db8
change names
0xCardinalError Nov 29, 2023
122a7a4
create admin role withs script
0xCardinalError Nov 29, 2023
ba980b4
add fetch and bump up newer ethers
0xCardinalError Nov 29, 2023
1221324
use older ethers version
0xCardinalError Nov 29, 2023
0dfd1df
add todos
0xCardinalError Nov 29, 2023
000b851
remove fetch test
0xCardinalError Nov 30, 2023
20abebe
add admin role check to bulk batch
0xCardinalError Dec 1, 2023
ce2e319
add new contracts deployment
0xCardinalError Dec 6, 2023
ff37a16
100 is mainnet swarm id
0xCardinalError Dec 6, 2023
487cd78
it is 1 after all
0xCardinalError Dec 6, 2023
4a776ec
latest batches and import
0xCardinalError Dec 6, 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
Prev Previous commit
Next Next commit
working bulk migration script
  • Loading branch information
0xCardinalError committed Nov 8, 2023
commit c3b446ae3e2ab5c1205e418503e4fe612f7ae12a
1,724 changes: 1,724 additions & 0 deletions deployments/tenderly/PostageStamp.json

Large diffs are not rendered by default.

711 changes: 711 additions & 0 deletions deployments/tenderly/PriceOracle.json

Large diffs are not rendered by default.

2,125 changes: 2,125 additions & 0 deletions deployments/tenderly/Redistribution.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

118 changes: 118 additions & 0 deletions deployments/tenderly/solcInputs/7d0578268e2dd60f7407510699fe32df.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const config: HardhatUserConfig = {
deploy: ['deploy/test/'],
},
tenderly: {
url: 'https://rpc.tenderly.co/fork/dc83044a-068e-445d-84dd-fbc38155f733',
url: 'https://rpc.tenderly.co/fork/4d1ff309-971f-49a2-81d2-6e18fa042806',
accounts,
chainId: 100,
deploy: ['deploy/main/'],
Expand Down
4 changes: 1 addition & 3 deletions scripts/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { ethers, network } from 'hardhat';
import hre from 'hardhat';

async function main() {
// This is deployer script for emergency deployment of only the postagestamp contract with some quick fixes

const provider = hre.ethers.provider;
const provider = ethers.provider;

const params = [
ethers.utils.hexValue(10), // hex encoded number of blocks to increase
0xCardinalError marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
7 changes: 3 additions & 4 deletions scripts/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@

async function main() {
// Read the JSON file with the batches
const batchesData = JSON.parse(fs.readFileSync('./batches2.json', 'utf8'));
const batchesData = JSON.parse(fs.readFileSync('./migration/batches2.json', 'utf8'));
const batches: Batch[] = batchesData.batches;

// Group the batches into chunks of 10
const chunkSize = 10;
const batchGroups: Batch[][] = chunkArray(batches, chunkSize);

// Assuming you have the contract deployed and have its address
const contractAddress = '0x7c89b0ac426ca28c4718ac96b5982052fbf8a3b6';
const contractAddress = '0x3a235fd10563fdd954c3199c08f4da132284287d';

const contract = await ethers.getContractAt('PostageStamp', contractAddress);

// Iterate over the chunks and send them to the smart contract
for (const group of batchGroups) {
const batchStructs = group.map((batch): any => ({
// Use the actual contract method parameters type instead of any if available
const batchStructs = group.map((batch) => ({
batchId: batch.batchid,
owner: batch.owner,
depth: batch.depth,
Expand All @@ -46,8 +45,8 @@
// Helper function to divide the array into chunks of a specific size
function chunkArray<T>(array: T[], size: number): T[][] {
return array.reduce((acc: T[][], val: T, i: number) => {
let idx = Math.floor(i / size);

Check failure on line 48 in scripts/migration.ts

View workflow job for this annotation

GitHub Actions / check

'idx' is never reassigned. Use 'const' instead
let page: T[] = acc[idx] || (acc[idx] = []);

Check failure on line 49 in scripts/migration.ts

View workflow job for this annotation

GitHub Actions / check

'page' is never reassigned. Use 'const' instead
page.push(val);
return acc;
}, []);
Expand Down
Loading