-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for proxy-based contract deployment
- Loading branch information
Showing
5 changed files
with
231 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Copyright (C) 2023 MrSpike63 | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, version 3. | ||
This program 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 Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
#include "curve_math.h" | ||
#include "keccak.h" | ||
#include "math.h" | ||
|
||
|
||
__global__ void __launch_bounds__(BLOCK_SIZE, 2) gpu_contract3_address_work(int score_method, Address origin, Address deployer, _uint256 base_key, _uint256 proxy_bytecode) { | ||
uint64_t thread_id = (uint64_t)threadIdx.x + (uint64_t)blockIdx.x * (uint64_t)BLOCK_SIZE; | ||
uint64_t key_offset = (uint64_t)THREAD_WORK * thread_id; | ||
|
||
_uint256 key = base_key; | ||
asm( | ||
"add.cc.u32 %0, %0, %8; \n\t" | ||
"addc.cc.u32 %1, %1, %9; \n\t" | ||
"addc.cc.u32 %2, %2, 0x0; \n\t" | ||
"addc.cc.u32 %3, %3, 0x0; \n\t" | ||
"addc.cc.u32 %4, %4, 0x0; \n\t" | ||
"addc.cc.u32 %5, %5, 0x0; \n\t" | ||
"addc.cc.u32 %6, %6, 0x0; \n\t" | ||
"addc.u32 %7, %7, 0x0; \n\t" | ||
: "+r"(key.h), "+r"(key.g), "+r"(key.f), "+r"(key.e), "+r"(key.d), "+r"(key.c), "+r"(key.b), "+r"(key.a) : "r"((uint32_t)(key_offset & 0xFFFFFFFF)), "r"((uint32_t)(key_offset >> 32)) | ||
); | ||
for (int i = 0; i < THREAD_WORK; i++) { | ||
_uint256 salt = calculate_create3_salt(origin, key); | ||
Address proxy = calculate_contract_address2(deployer, salt, proxy_bytecode); | ||
handle_output2(score_method, calculate_contract_address(proxy, 1), key_offset + i); | ||
key.h += 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.