Skip to content

Commit 0cb3bf1

Browse files
authored
Merge pull request #2 from bandprotocol/fix-executor-size
Fix executor size check on Google function code
2 parents 7db09af + 462a4d2 commit 0cb3bf1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: lambda gcf
22

3-
VERSION=2.0.0
3+
VERSION=2.0.1
44
CURRENT_DIR=$(shell pwd)
55

66
lambda:

google-cloud-functions/google_cloud_function.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def execute(request):
5252
request_json = request.get_json(force=True)
5353
if "executable" not in request_json:
5454
return bad_request("Missing executable value")
55-
if len(request_json["executable"]) > MAX_EXECUTABLE:
55+
executable = base64.b64decode(request_json["executable"])
56+
if len(executable) > MAX_EXECUTABLE:
5657
return bad_request("Executable exceeds max size")
5758
if "calldata" not in request_json:
5859
return bad_request("Missing calldata value")
@@ -67,7 +68,7 @@ def execute(request):
6768

6869
path = "/tmp/execute.sh"
6970
with open(path, "w") as f:
70-
f.write(base64.b64decode(request_json["executable"]).decode())
71+
f.write(executable.decode())
7172

7273
os.chmod(path, 0o775)
7374
try:

0 commit comments

Comments
 (0)