Skip to content

Commit

Permalink
chore: fix code for signer server
Browse files Browse the repository at this point in the history
  • Loading branch information
perfogic committed Dec 18, 2024
1 parent b60557e commit ac94165
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/orchestrator/src/services/contract-simulate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ class ContractSimulator {

static async loadStateAndCode(fileName: string, contractAddress: string) {
const code = readFileSync(path.join(__dirname, `wasm/${fileName}.wasm`));
const oldCode = readFileSync(
path.join(
os.homedir(),
`${env.server.storageDirName}/data/final/${contractAddress}`
)
);
const state = readFileSync(
path.join(
os.homedir(),
Expand All @@ -105,15 +111,15 @@ class ContractSimulator {
);
const { codeId } = await this.simulateClient.upload(
this.sender,
code,
oldCode,
"auto"
);
const raw = SortedMap.rawPack(
new BufferCollection(state as any) as any,
compare
);
await this.simulateClient.loadContract(
env.cosmos.appBitcoin,
contractAddress,
{
codeId: codeId,
admin: this.sender,
Expand All @@ -123,6 +129,18 @@ class ContractSimulator {
},
raw
);
const { codeId: newCodeId } = await this.simulateClient.upload(
this.sender,
code,
"auto"
);
await this.simulateClient.migrate(
this.sender,
contractAddress,
newCodeId,
{},
"auto"
);
}

static copyFolderContents = (source: string, destination: string) => {
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions packages/orchestrator/src/services/signer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class SignerService implements RelayerInterface {
}
} catch (err) {
this.logger.error(`[START_CHECKPOINT_SIGNING] Error:`, err);
console.log(err);
}

await setTimeout(ITERATION_DELAY.RELAY_SIGNATURES_INTERVAL);
Expand Down

0 comments on commit ac94165

Please sign in to comment.