Skip to content

Commit

Permalink
Revert "Bug fix for large binary with unlink libraries codegen"
Browse files Browse the repository at this point in the history
This reverts commit 350560a.
  • Loading branch information
tonykwok1992 committed Mar 16, 2024
1 parent b694fb7 commit 532dfe6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private FieldSpec createLibrariesLinkedBinaryField() {
.build();
}

FieldSpec createBinaryDefinition(String binary) {
private FieldSpec createBinaryDefinition(String binary) {
if (binary.length() < 65534) {
return FieldSpec.builder(String.class, BINARY)
.addModifiers(Modifier.PUBLIC, Modifier.FINAL, Modifier.STATIC)
Expand All @@ -407,7 +407,7 @@ FieldSpec createBinaryDefinition(String binary) {
StringBuilder stringBuilderString = new StringBuilder().append("new StringBuilder()");
for (String s : argsArray) {
stringBuilderString.append(".append(\"");
stringBuilderString.append(s.replaceAll("\\$", "\\$\\$")); //escape $ which bytecode may contain
stringBuilderString.append(s);
stringBuilderString.append("\")");
}
stringBuilderString.append(".toString()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ public void testContractWithLargeBinary() throws Exception {
testCodeGenerationJvmTypes("large", "Large");
}

@Test
public void testContractWithLargeBinaryAndUnlinkedLib() throws Exception {
testCodeGenerationJvmTypes("largewithunlinkedlib", "largewithunlinkedlib");
}

@Test
public void testShipIt() throws Exception {
testCodeGenerationJvmTypes("shipit", "ShipIt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
import java.util.Collections;
import java.util.List;

import com.squareup.javapoet.*;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -979,10 +983,4 @@ public void testBuildFunctionLinkBinaryWithReferences() throws Exception {

assertEquals(methodSpec.toString(), (expected));
}


@Test
public void testBinaryWithUnlinkedLibraryLengthOver65534() throws Exception {
solidityFunctionWrapper.createBinaryDefinition("0x" + "a".repeat(40000) + "__$927c5a12e2f339676f56d42ec1c0537964$__" + "a".repeat(40000));
}
}

This file was deleted.

This file was deleted.

0 comments on commit 532dfe6

Please sign in to comment.